1--TEST--
2Observer: fatal errors caught with zend_try will not fire end handlers prematurely
3--SKIPIF--
4<?php if (!extension_loaded('zend-test')) die('skip: zend-test extension required'); ?>
5<?php if (!extension_loaded('soap')) die('skip: soap extension required'); ?>
6--INI--
7zend_test.observer.enabled=1
8zend_test.observer.observe_all=1
9zend_test.observer.show_return_value=1
10--FILE--
11<?php
12function foo()
13{
14    // ext/soap catches a zend_bailout and then throws an exception
15    $client = new SoapClient('foo');
16}
17
18function main()
19{
20    foo();
21}
22
23// try/catch is on main() to ensure ZEND_HANDLE_EXCEPTION does not fire the end handlers again
24try {
25    main();
26} catch (SoapFault $e) {
27    echo $e->getMessage() . PHP_EOL;
28}
29
30echo 'Done.' . PHP_EOL;
31?>
32--EXPECTF--
33<!-- init '%s%eobserver_error_%d.php' -->
34<file '%s%eobserver_error_%d.php'>
35  <!-- init main() -->
36  <main>
37    <!-- init foo() -->
38    <foo>
39      <!-- Exception: SoapFault -->
40    </foo:NULL>
41    <!-- Exception: SoapFault -->
42  </main:NULL>
43SOAP-ERROR: Parsing WSDL: Couldn't load from 'foo' : failed to load external entity "foo"
44
45Done.
46</file '%s%eobserver_error_%d.php'>
47