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