xref: /PHP-8.2/sapi/phpdbg/tests/watch_006.phpt (revision 57463cf7)
1--TEST--
2Test multiple watch elements pointing to the same 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--PHPDBG--
13b 4
14r
15w $a[0]
16w r $b
17c
18
19
20
21
22
23
24q
25--EXPECTF--
26[Successful compilation of %s]
27prompt> [Breakpoint #0 added at %s:4]
28prompt> [Breakpoint #0 at %s:4, hits: 1]
29>00004: $a[0] = 1;
30 00005: $b = &$a;
31 00006: $a[0] = 2;
32prompt> [Added watchpoint #0 for $a[0]]
33prompt> [Added recursive watchpoint #1 for $b]
34prompt> [Breaking on watchpoint $a[0]]
35Old value: 0
36New value: 1
37>00005: $b = &$a;
38 00006: $a[0] = 2;
39 00007: $a[1] = 3;
40prompt> [Breaking on watchpoint $b]
41Old value:
42New value (reference): Array ([0] => 1)
43>00006: $a[0] = 2;
44 00007: $a[1] = 3;
45 00008: $c = [1];
46prompt> [Breaking on watchpoint $a[0]]
47Old value: 1
48New value: 2
49>00007: $a[1] = 3;
50 00008: $c = [1];
51 00009: $b = &$c;
52prompt> [Element 1 has been added to watchpoint]
53[Breaking on watchpoint $b[]]
541 elements were added to the array
55>00008: $c = [1];
56 00009: $b = &$c;
57 00010:
58prompt> [Breaking on watchpoint $b]
59Old value inaccessible or destroyed
60New value (reference): Array ([0] => 2,[1] => 3)
61>00009: $b = &$c;
62 00010:
63prompt> [Breaking on watchpoint $b]
64Old value inaccessible or destroyed
65New value (reference): Array ([0] => 1)
66>00010:
67prompt> [$b has been removed, removing watchpoint recursively]
68[$a[0] has been removed, removing watchpoint]
69[Script ended normally]
70prompt>
71--FILE--
72<?php
73
74$a = [0];
75$a[0] = 1;
76$b = &$a;
77$a[0] = 2;
78$a[1] = 3;
79$c = [1];
80$b = &$c;
81