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' -->
29<file '%s'>
30  <!-- init register_shutdown_function() -->
31  <register_shutdown_function>
32  </register_shutdown_function:NULL>
33  <!-- init bar() -->
34  <bar>
35  </bar:40>
36Done: 40
37</file '%s'>
38<!-- init {closure:%s:%d}() -->
39<{closure:%s:%d}>
40  <!-- init foo() -->
41  <foo>
42    <bar>
43    </bar:41>
44    <bar>
45    </bar:42>
46  </foo:42>
47Shutdown: 42
48</{closure:%s:%d}:NULL>
49