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