1
0
mirror of https://github.com/php/php-src.git synced 2026-04-23 16:08:35 +02:00
Files
archived-php-src/ext/zend_test/tests/observer_error_05.phpt
T
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
801 B
PHP

--TEST--
Observer: End handlers fire after a userland fatal error
--EXTENSIONS--
zend_test
--INI--
zend_test.observer.enabled=1
zend_test.observer.observe_all=1
zend_test.observer.show_return_value=1
--FILE--
<?php
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
trigger_error('Foo error', E_USER_ERROR);
});
function foo()
{
return $x; // warning
}
foo();
echo 'You should not see this.';
?>
--EXPECTF--
<!-- init '%s' -->
<file '%s'>
<!-- init set_error_handler() -->
<set_error_handler>
</set_error_handler:NULL>
<!-- init foo() -->
<foo>
<!-- init {closure}() -->
<{closure}>
<!-- init trigger_error() -->
<trigger_error>
Fatal error: Foo error in %s on line %d
</trigger_error:NULL>
</{closure}:NULL>
</foo:NULL>
</file '%s'>