1--TEST--
2Observer: Function calls from a shutdown handler are observable
3--SKIPIF--
4<?php if (!extension_loaded('zend-test')) die('skip: zend-test extension required'); ?>
5--INI--
6zend_test.observer.enabled=1
7zend_test.observer.observe_all=1
8zend_test.observer.show_return_value=1
9--FILE--
10<?php
11register_shutdown_function(function () {
12    echo 'Shutdown: ' . foo() . PHP_EOL;
13});
14
15function bar($arg) {
16    return $arg;
17}
18
19function foo() {
20    bar(41);
21    return bar(42);
22}
23
24echo 'Done: ' . bar(40) . PHP_EOL;
25?>
26--EXPECTF--
27<!-- init '%s%eobserver_shutdown_%d.php' -->
28<file '%s%eobserver_shutdown_%d.php'>
29  <!-- init bar() -->
30  <bar>
31  </bar:40>
32Done: 40
33</file '%s%eobserver_shutdown_%d.php'>
34<!-- init {closure}() -->
35<{closure}>
36  <!-- init foo() -->
37  <foo>
38    <bar>
39    </bar:41>
40    <bar>
41    </bar:42>
42  </foo:42>
43Shutdown: 42
44</{closure}:NULL>
45