1
0
mirror of https://github.com/php/php-src.git synced 2026-04-04 22:52:40 +02:00
Files
archived-php-src/ext/zend_test/tests/observer_basic_01.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

70 lines
970 B
PHP

--TEST--
Observer: Basic observability of userland functions
--EXTENSIONS--
zend_test
--INI--
zend_test.observer.enabled=1
zend_test.observer.observe_all=1
--FILE--
<?php
function bar()
{
echo 'Bar' . PHP_EOL;
var_dump(array_sum([1,2,3]));
}
function foo()
{
echo 'Foo' . PHP_EOL;
bar();
}
foo();
foo();
foo();
echo 'DONE' . PHP_EOL;
?>
--EXPECTF--
<!-- init '%s%eobserver_basic_%d.php' -->
<file '%s%eobserver_basic_%d.php'>
<!-- init foo() -->
<foo>
Foo
<!-- init bar() -->
<bar>
Bar
<!-- init array_sum() -->
<array_sum>
</array_sum>
<!-- init var_dump() -->
<var_dump>
int(6)
</var_dump>
</bar>
</foo>
<foo>
Foo
<bar>
Bar
<array_sum>
</array_sum>
<var_dump>
int(6)
</var_dump>
</bar>
</foo>
<foo>
Foo
<bar>
Bar
<array_sum>
</array_sum>
<var_dump>
int(6)
</var_dump>
</bar>
</foo>
DONE
</file '%s%eobserver_basic_%d.php'>