New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with preloading in PHP 7.4 #1969
Comments
Hi I tried different ways to run opcache (enabling it in CLI and in Apache) using your script with all PHP files of Carbon and I get "[Preloader] Preloaded I run PHP 7.4.0. I have no clue of why OPCache fail on this code and would it expect to be used instead. I tried randomly a change that would be acceptable using Please try to require If not I will need more input:
Also @nikic talked about class_alias in the PHP bug track, which does not sound related to Carbon code you mention. He's also talking about fixing things PHP side. So I'm not sure it's something we should handle in Carbon. |
@brendt, @frinux, @vladyslavstartsev, @chrysanthos, @YevhenKushnir I'm ready to help, but removing code is not a solution. If one of you may test requiring But for now, as the code mentioned above is valid PHP code, I consider this is an OPCache bug, not a Carbon bug. @brendt you suggest to Nikita to close https://bugs.php.net/bug.php?id=78918 as you get preloading working commenting the problematic code. But I think it's not a reason to close the bug, OPCache fails on this code, this deserves an explanation about why and what to do instead at least, or simply a patch to OPCache to support this code. |
@kylekatarnls The problem here is that you are using Your code is of course not wrong in itself, as you do not expect Your change in the |
Thanks @nikic for the confirmation, if this syntax may become invalid in PHP 8, I'm OK to anticipate this change and use our interface instead. It's theoretically a breaking change as this trait may have been used with those constants set to different values. But this should be pretty rare and those users can easily override the whole |
This is supposed to be fixed by #1972. You can test it requiring This will be released in 2.29.0. |
Hi Kyle, thanks for looking into this! I can confirm it works now with these changes. It might be best to 2.29.0 around the time or before PHP 7.4.2 is released, since that's the release which gets preloading to work. |
There's an issue with the
\Carbon\Traits\Date
trait preventing being able to properly preload a laravel project (and any project using carbon).The issue has to do with unknown constants, more specifically: https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Traits/Date.php#L541-L556
I've been trying to preload Laravel over the past few weeks, and got it working on the latest 7.4 dev build (as of writing that's 7.4.2-dev).
This is the preload script I'm using: https://github.com/brendt/aggregate.stitcher.io/blob/master/preload.php
More information about what goes wrong can be found in https://bugs.php.net/bug.php?id=78918
Commenting out these lines gets preloading to work. I'm not sure what the best solution is, but as of now this small piece of code prevents us from preloading Laravel (once 7.4.2 is released)
The text was updated successfully, but these errors were encountered: