1--TEST-- 2Observer: Show backtrace on init 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_init_backtrace=1 10--FILE-- 11<?php 12class TestClass 13{ 14 private function bar($number) 15 { 16 return $number + 2; 17 } 18 19 public function foo() 20 { 21 return array_map(function ($value) { 22 return $this->bar($value); 23 }, [40, 1335]); 24 } 25} 26 27function gen() 28{ 29 $test = new TestClass(); 30 yield $test->foo(); 31} 32 33function foo() 34{ 35 return gen()->current(); 36} 37 38var_dump(foo()); 39?> 40--EXPECTF-- 41<!-- init '%s%eobserver_backtrace_%d.php' --> 42<!-- 43 {main} %s%eobserver_backtrace_%d.php 44--> 45<file '%s%eobserver_backtrace_%d.php'> 46 <!-- init foo() --> 47 <!-- 48 foo() 49 {main} %s%eobserver_backtrace_%d.php 50 --> 51 <foo> 52 <!-- init Generator::current() --> 53 <!-- 54 Generator::current() 55 foo() 56 {main} %s%eobserver_backtrace_%d.php 57 --> 58 <Generator::current> 59 <!-- init gen() --> 60 <!-- 61 gen() 62 Generator::current() 63 foo() 64 {main} %s%eobserver_backtrace_%d.php 65 --> 66 <gen> 67 <!-- init TestClass::foo() --> 68 <!-- 69 TestClass::foo() 70 gen() 71 Generator::current() 72 foo() 73 {main} %s%eobserver_backtrace_%d.php 74 --> 75 <TestClass::foo> 76 <!-- init array_map() --> 77 <!-- 78 array_map() 79 TestClass::foo() 80 gen() 81 Generator::current() 82 foo() 83 {main} %s%eobserver_backtrace_%d.php 84 --> 85 <array_map> 86 <!-- init TestClass::{closure:%s:%d}() --> 87 <!-- 88 TestClass::{closure:%s:%d}() 89 array_map() 90 TestClass::foo() 91 gen() 92 Generator::current() 93 foo() 94 {main} %s%eobserver_backtrace_%d.php 95 --> 96 <TestClass::{closure:%s:%d}> 97 <!-- init TestClass::bar() --> 98 <!-- 99 TestClass::bar() 100 TestClass::{closure:%s:%d}() 101 array_map() 102 TestClass::foo() 103 gen() 104 Generator::current() 105 foo() 106 {main} %s%eobserver_backtrace_%d.php 107 --> 108 <TestClass::bar> 109 </TestClass::bar> 110 </TestClass::{closure:%s:%d}> 111 <TestClass::{closure:%s:%d}> 112 <TestClass::bar> 113 </TestClass::bar> 114 </TestClass::{closure:%s:%d}> 115 </array_map> 116 </TestClass::foo> 117 </gen> 118 </Generator::current> 119 </foo> 120 <!-- init var_dump() --> 121 <!-- 122 var_dump() 123 {main} %s%eobserver_backtrace_%d.php 124 --> 125 <var_dump> 126array(2) { 127 [0]=> 128 int(42) 129 [1]=> 130 int(1337) 131} 132 </var_dump> 133</file '%s%eobserver_backtrace_%d.php'> 134