1--TEST--
2Observer: Function calls from a shutdown handler 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
12register_shutdown_function(function () {
13    echo 'Shutdown: ' . foo() . PHP_EOL;
14});
15
16function bar($arg) {
17    return $arg;
18}
19
20function foo() {
21    bar(41);
22    return bar(42);
23}
24
25echo 'Done: ' . bar(40) . PHP_EOL;
26?>
27--EXPECTF--
28<!-- init '%s%eobserver_shutdown_%d.php' -->
29<file '%s%eobserver_shutdown_%d.php'>
30  <!-- init bar() -->
31  <bar>
32  </bar:40>
33Done: 40
34</file '%s%eobserver_shutdown_%d.php'>
35<!-- init {closure}() -->
36<{closure}>
37  <!-- init foo() -->
38  <foo>
39    <bar>
40    </bar:41>
41    <bar>
42    </bar:42>
43  </foo:42>
44Shutdown: 42
45</{closure}:NULL>
46