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