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--SKIPIF--
12<?php
13if (getenv("USE_ZEND_ALLOC") === "0") die("skip requires zmm");
14?>
15--FILE--
16<?php
17
18function d() {} // observed
19
20function c() {
21    d();
22}
23
24function b() {
25    c();
26}
27
28function bailout(...$args) {
29    array_map("str_repeat", ["\xFF"], [100000000]);
30}
31
32function a() { // observed (first_observed_frame)
33    b();
34    bailout(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); // overwrite the vm_stack containing prev_execute_data
35}
36
37a();
38
39?>
40--EXPECTF--
41<!-- init '%s' -->
42<!-- init a() -->
43<a>
44  <!-- init b() -->
45  <!-- init c() -->
46  <!-- init d() -->
47  <d>
48  </d>
49  <!-- init bailout() -->
50  <!-- init array_map() -->
51  <!-- init str_repeat() -->
52
53Fatal error: Allowed memory size of 20971520 bytes exhausted %s in %s on line %d
54</a>
55