1--TEST--
2Observer: Function calls from a __destruct during shutdown are observable
3--EXTENSIONS--
4zend_test
5--INI--
6zend_test.observer.enabled=1
7zend_test.observer.show_output=1
8zend_test.observer.observe_all=1
9zend_test.observer.show_return_value=1
10--FILE--
11<?php
12class MyClass
13{
14    public function __destruct()
15    {
16        echo 'Shutdown: ' . foo() . PHP_EOL;
17    }
18}
19
20function bar($arg) {
21    return $arg;
22}
23
24function foo() {
25    bar(41);
26    return bar(42);
27}
28
29$mc = new MyClass();
30
31echo 'Done: ' . bar(40) . PHP_EOL;
32?>
33--EXPECTF--
34<!-- init '%s%eobserver_shutdown_%d.php' -->
35<file '%s%eobserver_shutdown_%d.php'>
36  <!-- init bar() -->
37  <bar>
38  </bar:40>
39Done: 40
40</file '%s%eobserver_shutdown_%d.php'>
41<!-- init MyClass::__destruct() -->
42<MyClass::__destruct>
43  <!-- init foo() -->
44  <foo>
45    <bar>
46    </bar:41>
47    <bar>
48    </bar:42>
49  </foo:42>
50Shutdown: 42
51</MyClass::__destruct:NULL>
52