-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dynamic function definition in preload script
We should use normal function renaming if the function is declared during preloading itself, rather than afterwards. This fixes a regression introduced by 68f80be.
- Loading branch information
Showing
3 changed files
with
24 additions
and
1 deletion.
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,4 @@ | ||
<?php | ||
if (1) { | ||
function f() {} | ||
} |
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 @@ | ||
--TEST-- | ||
Defining a dynamic function inside the preload script | ||
--INI-- | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.optimization_level=-1 | ||
opcache.preload={PWD}/preload_dynamic_function.inc | ||
--SKIPIF-- | ||
<?php | ||
require_once('skipif.inc'); | ||
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows'); | ||
?> | ||
--FILE-- | ||
<?php | ||
var_dump(function_exists("f")); | ||
?> | ||
--EXPECT-- | ||
bool(true) |