Running concrete5 using phalanger
8 posts
• Page 1 of 1
Running concrete5 using phalanger
I'm doing a lot of work with a CMS called concrete5. It's not as big as Wordpress, Drupal etc. but it has gotten a lot of attention lately and grows pretty fast.
Since I already have a nice Phalanger set up I tried to run it there as well. I managed to get around a few problems but there's one I'm not sure how to handle.
concrete5 has a super class which contains a few very basic methods. This class is called "Object". A name pretty obvious but probably not a good name for the .NET platform.
It fails with this error:
Is there anything I can do to tell Phalanger to map this class name to a different name? Other ideas?
Since I already have a nice Phalanger set up I tried to run it there as well. I managed to get around a few problems but there's one I'm not sure how to handle.
concrete5 has a super class which contains a few very basic methods. This class is called "Object". A name pretty obvious but probably not a good name for the .NET platform.
It fails with this error:
CompileError (2014): Syntax error: unexpected token 'Object' in ...
Is there anything I can do to tell Phalanger to map this class name to a different name? Other ideas?
- Remo
- Posts: 17
- Joined: August 17th, 2012, 3:25 pm
Re: Running concrete5 using phalanger
'Object' is a reserved keyword name in CLR language features. You have probably enabled CLR features, that are practically not important. I would suggest to disable them (note, they are automatically enabled in Pure mode)
CLR language features also reserve bool, int etc. and allows you to access their object members ($x = 1; $x->ToString();)
CLR language features also reserve bool, int etc. and allows you to access their object members ($x = 1; $x->ToString();)
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Running concrete5 using phalanger
Thanks a ton Jakub!
You're absolutely correct, CLR was enabled.
I did have to make some minor changes in concrete5, but that could be, because I'm running an ancient version, but at the end, I'm able to run concrete5 using Phalanger! Once the concrete5 cache has been filled, it feels super fast!
I'll try to start from scratch with an up-to-date version and report the result but I think it should be quite a bit faster than the PHP version. Great stuff!
You're absolutely correct, CLR was enabled.
I did have to make some minor changes in concrete5, but that could be, because I'm running an ancient version, but at the end, I'm able to run concrete5 using Phalanger! Once the concrete5 cache has been filled, it feels super fast!
I'll try to start from scratch with an up-to-date version and report the result but I think it should be quite a bit faster than the PHP version. Great stuff!
- Remo
- Posts: 17
- Joined: August 17th, 2012, 3:25 pm
Re: Running concrete5 using phalanger
Thank you too! Great to see another project running on Phalanger.
Please keep us informed, whether things go as they should ...
Please keep us informed, whether things go as they should ...
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Running concrete5 using phalanger
It looks like the newer version does worse. If I don't rewrite any code, I get a fatal error:
I can partially get around that class but I haven't found a proper way to avoid ReflectionMethod. I'll investigate this tomorrow.
Error: Class 'ReflectionMethod' not found in....
I can partially get around that class but I haven't found a proper way to avoid ReflectionMethod. I'll investigate this tomorrow.
- Remo
- Posts: 17
- Joined: August 17th, 2012, 3:25 pm
Re: Running concrete5 using phalanger
Remo wrote:I can partially get around that class but I haven't found a proper way to avoid ReflectionMethod. I'll investigate this tomorrow.
ReflectionMethod is not implemented in Phalanger yet. We are implementing support of PHP Reflection as it is needed, or we are taking implementations done by users on GitHub (https://github.com/DEVSENSE/Phalanger)
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Running concrete5 using phalanger
I do have quite a bit of experience with .NET but more on the database / business logic side and not with stuff like DLR, AST, etc.
But I might be able to rewrite this PHP code:
https://github.com/concrete5/concrete5/ ... er.php#L96
But I might be able to rewrite this PHP code:
https://github.com/concrete5/concrete5/ ... er.php#L96
- Remo
- Posts: 17
- Joined: August 17th, 2012, 3:25 pm
Re: Running concrete5 using phalanger
I'm able to get around that problem but the next problems are popping up rather quickly. I can run an already installed site using Phalanger and can't find any problems in a minute.
However, the installation process is a completely different story. From what I've seen it's not because of Phalanger but rather because of concrete5.
1 Different method declarations. Single_Page extends Page and both have a method called getByID, but with different parameters. PHP doesn't bother much about that, but .NET does.. Same goes for the method add. I was able to change the parameter names in concrete5. They sound wired now but it works..
2 Access to $this while it's not initialized. Again, PHP doesn't care but we do.. Posted a comment about this here https://github.com/concrete5/concrete5/ ... 6c11ffbecd I was able to fix that by adding if (is_object(...
3 include_path problems. concrete5 changes the include path at runtime to make it easy to work with some 3rdparty libraries. Unfortunately it doesn't use DIRECTORY_SEPARATOR which is what I think causes the problem. At runtime we put c:/htdocs/ into the include_path but then try to include a file from c:\htdocs\concrete\foobar.php While we humans know that it's within the include_path, it isn't if you just compare the strings. Here's the real world error:
I'm not entirely sure how to fix that, this is at least, as long as I don't want to replace every / in the code..
I'll post this in the concrete5 community, maybe someone is willing to help as well! --> http://www.concrete5.org/community/foru ... p-of-.net/
However, the installation process is a completely different story. From what I've seen it's not because of Phalanger but rather because of concrete5.
1 Different method declarations. Single_Page extends Page and both have a method called getByID, but with different parameters. PHP doesn't bother much about that, but .NET does.. Same goes for the method add. I was able to change the parameter names in concrete5. They sound wired now but it works..
2 Access to $this while it's not initialized. Again, PHP doesn't care but we do.. Posted a comment about this here https://github.com/concrete5/concrete5/ ... 6c11ffbecd I was able to fix that by adding if (is_object(...
3 include_path problems. concrete5 changes the include path at runtime to make it easy to work with some 3rdparty libraries. Unfortunately it doesn't use DIRECTORY_SEPARATOR which is what I think causes the problem. At runtime we put c:/htdocs/ into the include_path but then try to include a file from c:\htdocs\concrete\foobar.php While we humans know that it's within the include_path, it isn't if you just compare the strings. Here's the real world error:
Error: Script 'C:\Users\Remo\concrete5\web\concrete/core/models/starting_point_install_routine.php' inclusion failed. Cause: Script cannot be included with current configuration. Search paths: include_path is 'C:\Users\Remo\concrete5\web/libraries/3rdparty;C:\Users\Remo\concrete5\web\concrete/libraries/3rdparty;.', working directory is 'C:\Users\Remo\concrete5\web' in C:\Users\Remo\concrete5\web\concrete\core\libraries\loader.php on line 141, column 5.
I'm not entirely sure how to fix that, this is at least, as long as I don't want to replace every / in the code..
I'll post this in the concrete5 community, maybe someone is willing to help as well! --> http://www.concrete5.org/community/foru ... p-of-.net/
- Remo
- Posts: 17
- Joined: August 17th, 2012, 3:25 pm
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 7 guests