Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #20455 [ClassLoader] Fix ClassCollectionLoader inlining with __ha…
…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
- Loading branch information
Showing
6 changed files
with
67 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/WithDirMagic.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
/* | ||
* foo | ||
*/ | ||
|
||
namespace Namespaced; | ||
|
||
class WithDirMagic | ||
{ | ||
public function getDir() | ||
{ | ||
return __DIR__; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/WithFileMagic.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
/* | ||
* foo | ||
*/ | ||
|
||
namespace Namespaced; | ||
|
||
class WithFileMagic | ||
{ | ||
public function getFile() | ||
{ | ||
return __FILE__; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/WithHaltCompiler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
/* | ||
* foo | ||
*/ | ||
|
||
namespace Namespaced; | ||
|
||
class WithHaltCompiler | ||
{ | ||
} | ||
|
||
// the end of the script execution | ||
__halt_compiler(); data | ||
data | ||
data | ||
data | ||
... |