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
[ClassLoader] Fix ClassCollectionLoader inlining with declare(strict_types=1) #19859
Conversation
92b73f3
to
466de62
Compare
So, basically, you prevent files with strict types to be inlined (via a require), is that correct? |
466de62
to
647b3d2
Compare
I "inline" them by doing a straight "require" yes. We can't exclude them, because they might be parent classes of non strict classes. |
throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir)); | ||
} | ||
$cacheDir = rtrim(realpath($cacheDir), '/'.DIRECTORY_SEPARATOR); | ||
$cache = $cacheDir.DIRECTORY_SEPARATOR.$name.$extension; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole section does not look related to the fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is: these are some lines moved from the bottom to the before the below loop.
https://github.com/symfony/symfony/pull/19859/files?w=1
Thank you @nicolas-grekas. |
…are(strict_types=1) (nicolas-grekas) This PR was merged into the 2.7 branch. Discussion ---------- [ClassLoader] Fix ClassCollectionLoader inlining with declare(strict_types=1) | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | Tests pass? | yes | Fixed tickets | #19845 | License | MIT See diff as https://github.com/symfony/symfony/pull/19859/files?w=1 Commits ------- 647b3d2 [ClassLoader] Fix ClassCollectionLoader inlining with declare(strict_types=1)
…lt_compiler (giosh94mhz) This PR was squashed before being merged into the 2.7 branch (closes #20455). Discussion ---------- [ClassLoader] Fix ClassCollectionLoader inlining with __halt_compiler | Q | A | ------------- | --- | Branch? | 2.7+ | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | | License | MIT | Doc PR | | I have some PHP classes which ends with an `__halt_compiler` call which fail on production. This is due to the ClassCollectionLoader inlining the class code (which is followed by random binary data) which breaks PHP parsing of the following classes. I found this issue while using ZendGuardLoader module, but this apply to whatever php class using this function call. I've made my fix, based on #19859, and tested it with symfony 2.7 and 2.8 Commits ------- a60cd15 [ClassLoader] Fix ClassCollectionLoader inlining with __halt_compiler
See diff as https://github.com/symfony/symfony/pull/19859/files?w=1