1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 01:48:26 +02:00
Files
archived-php-src/ext/zend_test/tests/observer_error_04.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

55 lines
1.3 KiB
PHP

--TEST--
Observer: fatal errors caught with zend_try will not fire end handlers prematurely
--EXTENSIONS--
zend_test
soap
--INI--
zend_test.observer.enabled=1
zend_test.observer.observe_all=1
zend_test.observer.show_return_value=1
--FILE--
<?php
function foo()
{
// ext/soap catches a zend_bailout and then throws an exception
$client = new SoapClient('foo');
}
function main()
{
foo();
}
// try/catch is on main() to ensure ZEND_HANDLE_EXCEPTION does not fire the end handlers again
try {
main();
} catch (SoapFault $e) {
echo $e->getMessage() . PHP_EOL;
}
echo 'Done.' . PHP_EOL;
?>
--EXPECTF--
<!-- init '%s%eobserver_error_%d.php' -->
<file '%s%eobserver_error_%d.php'>
<!-- init main() -->
<main>
<!-- init foo() -->
<foo>
<!-- init SoapClient::__construct() -->
<SoapClient::__construct>
<!-- Exception: SoapFault -->
</SoapClient::__construct:NULL>
<!-- Exception: SoapFault -->
</foo:NULL>
<!-- Exception: SoapFault -->
</main:NULL>
<!-- init Exception::getMessage() -->
<Exception::getMessage>
</Exception::getMessage:'SOAP-ERROR: Parsing WSDL: Couldn\'t load from \'foo\' : failed to load external entity "foo"
'>
SOAP-ERROR: Parsing WSDL: Couldn't load from 'foo' : failed to load external entity "foo"
Done.
</file '%s%eobserver_error_%d.php'>