-
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.
Add observer temporary to dl'ed functions
When observer is enabled, we normally add an extra temporary to all functions, to store the previously observed frame. However, this is done in zend_observer_post_startup() so it doesn't happen to dl'ed() functions. One possible fix would be to move that from zend_observer_post_startup() to zend_register_functions(), but this would be too early: Observer may not be enabled when zend_register_functions() is called, and may still be enabled later. However, when zend_register_functions() is called at run-time (during dl()), we know definitively whether observer is enabled. Here I update zend_register_functions() to add a temporary to dl'ed() functions when observer is enabled. Fixes: GH-17211 Closes: GH-17220
- Loading branch information
Showing
6 changed files
with
95 additions
and
2 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,42 @@ | ||
--TEST-- | ||
dl() / observer segfault | ||
--EXTENSIONS-- | ||
zend_test | ||
--SKIPIF-- | ||
<?php include dirname(__DIR__, 3) . "/dl_test/tests/skip.inc"; ?> | ||
--INI-- | ||
zend_test.observer.enabled=1 | ||
zend_test.observer.observe_functions=1 | ||
zend_test.observer.show_output=1 | ||
--FILE-- | ||
<?php | ||
|
||
if (PHP_OS_FAMILY === 'Windows') { | ||
$loaded = dl('php_dl_test.dll'); | ||
} else { | ||
$loaded = dl('dl_test.so'); | ||
} | ||
|
||
var_dump(dl_test_test2("World!")); | ||
|
||
$test = new DlTest(); | ||
var_dump($test->test("World!")); | ||
?> | ||
--EXPECTF-- | ||
<!-- init '%sgh17211.php' --> | ||
<!-- init dl() --> | ||
<dl> | ||
</dl> | ||
<!-- init dl_test_test2() --> | ||
<dl_test_test2> | ||
</dl_test_test2> | ||
<!-- init var_dump() --> | ||
<var_dump> | ||
string(12) "Hello World!" | ||
</var_dump> | ||
<!-- init DlTest::test() --> | ||
<DlTest::test> | ||
</DlTest::test> | ||
<var_dump> | ||
string(12) "Hello World!" | ||
</var_dump> |