1--TEST--
2Bug #81435 (Observer current_observed_frame may point to an old (overwritten) frame)
3--EXTENSIONS--
4zend_test
5--INI--
6memory_limit=20M
7zend_test.observer.enabled=1
8zend_test.observer.show_output=1
9zend_test.observer.observe_function_names=a,d
10opcache.optimization_level=0
11--FILE--
12<?php
13
14function d() {} // observed
15
16function c() {
17    d();
18}
19
20function b() {
21    c();
22}
23
24function bailout(...$args) {
25    array_map("str_repeat", ["\xFF"], [100000000]);
26}
27
28function a() { // observed (first_observed_frame)
29    b();
30    bailout(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); // overwrite the vm_stack containing prev_execute_data
31}
32
33a();
34
35?>
36--EXPECTF--
37<!-- init '%s' -->
38<!-- init a() -->
39<a>
40  <!-- init b() -->
41  <!-- init c() -->
42  <!-- init d() -->
43  <d>
44  </d>
45  <!-- init bailout() -->
46
47Fatal error: Allowed memory size of 20971520 bytes exhausted %s in %s on line %d
48</a>
49