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