-
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 opcache preload with observers enabled
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 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,13 @@ | ||
<?php | ||
|
||
class Foo { | ||
public static function test() { | ||
return "foo::test"; | ||
} | ||
} | ||
|
||
if (true) { | ||
function foo() { | ||
return 'I should be observable'; | ||
} | ||
} |
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,38 @@ | ||
--TEST-- | ||
Observer: Test with basic preloading | ||
--EXTENSIONS-- | ||
zend_test | ||
opcache | ||
--INI-- | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.optimization_level=-1 | ||
opcache.preload={PWD}/observer_preload.inc | ||
zend_test.observer.enabled=1 | ||
zend_test.observer.observe_all=1 | ||
zend_test.observer.observe_declaring=1 | ||
zend_test.observer.show_return_value=1 | ||
--FILE-- | ||
<?php | ||
|
||
Foo::test(); | ||
foo(); | ||
|
||
echo 'Done' . PHP_EOL; | ||
?> | ||
--EXPECTF-- | ||
<!-- declared class 'foo' --> | ||
<!-- init '%sobserver_preload.inc' --> | ||
<file '%sobserver_preload.inc'> | ||
<!-- declared function 'foo' --> | ||
</file '%sobserver_preload.inc'> | ||
<!-- init '%sobserver_preload.php' --> | ||
<file '%sobserver_preload.php'> | ||
<!-- init Foo::test() --> | ||
<Foo::test> | ||
</Foo::test:'foo::test'> | ||
<!-- init foo() --> | ||
<foo> | ||
</foo:'I should be observable'> | ||
Done | ||
</file '%sobserver_preload.php'> |