You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.
PHP 5.3 requires class namespaces to be explicit, even for classes that are in the global namespace. The XHP-generated source code does not provide a \ prefix on class names so when used within a namespace declaration the generated code fails with a fatal error, e.g.:
Fatal error: Class 'my\current\namespace\xhp_div' not found in /path/to/file ...
I think the only workaround currently would be to manually import each of the xhp classes into the current namespace and unfortunately the backslash namespace prefix would cause generated code to be incompatible with php 5.2.
The text was updated successfully, but these errors were encountered:
I don't quite understand how the xhp code generator works. It shouldn't be difficult to add a \ somewhere but I'm failing to find where that should be added to make xhp output the explicit global namespace reference. :(
Ok I figured out how to implement it ... this breaks backwards compatibility with php 5.2 but that's fine for my purposes. The change is pushed to http://github.com/20after4/xhp
Thanks for the heads up on this. I added a special case for PHP 5.3 so that it will always reference the global namespace while instantiating XHP classes. Of course you'll have to be sure to not have a namespace in any file where you define XHP elements or else you'll never be able to instantiate them. Check out master and let me know if it works for you.
PHP 5.3 requires class namespaces to be explicit, even for classes that are in the global namespace. The XHP-generated source code does not provide a \ prefix on class names so when used within a namespace declaration the generated code fails with a fatal error, e.g.:
Fatal error: Class 'my\current\namespace\xhp_div' not found in /path/to/file ...
I think the only workaround currently would be to manually import each of the xhp classes into the current namespace and unfortunately the backslash namespace prefix would cause generated code to be incompatible with php 5.2.
The text was updated successfully, but these errors were encountered: