-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid registering top functions with opcache_compile_file()
Previously, this only worked for classes. It worked by preventing early binding, and then declaring the class at runtime. Instead of doing that, we now avoid calling zend_accel_load_script() completely, which prevents the functions from being added to the function table. Fixes GH-16668
- Loading branch information
Showing
5 changed files
with
37 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
function test() { | ||
echo __FUNCTION__, "()\n"; | ||
} | ||
|
||
function a() {} | ||
function b() {} | ||
function c() {} |
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,20 @@ | ||
--TEST-- | ||
GH-16668: opcache_compile_file() mistakenly declares top functions | ||
--INI-- | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
--EXTENSIONS-- | ||
opcache | ||
--FILE-- | ||
<?php | ||
opcache_compile_file(__DIR__ . '/gh16668.inc'); | ||
opcache_compile_file(__DIR__ . '/gh16668.inc'); | ||
var_dump(function_exists('test')); | ||
require __DIR__ . '/gh16668.inc'; | ||
var_dump(function_exists('test')); | ||
test(); | ||
?> | ||
--EXPECT-- | ||
bool(false) | ||
bool(true) | ||
test() |
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