1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 17:22:15 +01:00
Files
archived-php-src/ext/zend_test/tests/observer_basic_06.phpt
Bob Weinand 625f164963 Include internal functions in the observer API
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>
2022-07-30 19:20:55 +02:00

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>