xref: /PHP-8.3/sapi/phpdbg/tests/watch_001.phpt (revision c756e978)
1--TEST--
2Test simple recursive watchpoint
3--SKIPIF--
4<?php
5if (getenv('SKIP_ASAN')) {
6    die("skip intentionally causes segfaults");
7}
8?>
9--INI--
10opcache.optimization_level=0
11--PHPDBG--
12b 3
13r
14w r $b
15c
16
17
18
19q
20--EXPECTF--
21[Successful compilation of %s]
22prompt> [Breakpoint #0 added at %s:3]
23prompt> [Breakpoint #0 at %s:3, hits: 1]
24>00003: $a = 1;
25 00004: $b = [$a];
26 00005:
27prompt> [Added recursive watchpoint #0 for $b]
28prompt> [Breaking on watchpoint $b]
29Old value:
30New value: Array ([0] => 1)
31>00006: unset($b);
32 00007: $b = 2;
33 00008:
34prompt> [Breaking on watchpoint $b]
35Old value inaccessible or destroyed
36New value:
37>00007: $b = 2;
38 00008:
39prompt> [Breaking on watchpoint $b]
40Old value:
41New value: 2
42>00008:
43prompt> [$b has been removed, removing watchpoint recursively]
44[Script ended normally]
45prompt>
46--FILE--
47<?php
48
49$a = 1;
50$b = [$a];
51
52unset($b);
53$b = 2;
54