mirror of
https://github.com/php/php-src.git
synced 2026-03-26 17:22:15 +01:00
There are two main motivations to this: a) The logic for handling internal and userland observation can be unified. b) Unwinding of observed functions on a bailout does notably not include observers. Even if users of observers were to ensure such handling themselves, it would be impossible to retain the relative ordering - either the user has to unwind all internal observed frames before the automatic unwinding (zend_observer_fcall_end_all) or afterwards, but not properly interleaved. Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
42 lines
552 B
PHP
42 lines
552 B
PHP
--TEST--
|
|
Observer: Basic observability of functions only (with run-time swapping)
|
|
--EXTENSIONS--
|
|
zend_test
|
|
--INI--
|
|
zend_test.observer.enabled=1
|
|
zend_test.observer.observe_function_names=foo
|
|
--FILE--
|
|
<?php
|
|
function foo()
|
|
{
|
|
echo 'Foo' . PHP_EOL;
|
|
}
|
|
|
|
function bar()
|
|
{
|
|
echo 'Bar' . PHP_EOL;
|
|
}
|
|
|
|
foo();
|
|
bar();
|
|
|
|
ini_set("zend_test.observer.observe_function_names", "bar");
|
|
|
|
foo();
|
|
bar();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
<!-- init '%s%eobserver_basic_06.php' -->
|
|
<!-- init foo() -->
|
|
<foo>
|
|
Foo
|
|
</foo>
|
|
<!-- init bar() -->
|
|
Bar
|
|
<!-- init ini_set() -->
|
|
Foo
|
|
<bar>
|
|
Bar
|
|
</bar>
|