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