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