xref: /PHP-7.4/sapi/phpdbg/tests/watch_002.phpt (revision 54dd762f)
1--TEST--
2Test simple array watchpoint with replace
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 6
14r
15w a $a
16c
17
18q
19--EXPECTF--
20[Successful compilation of %s]
21prompt> [Breakpoint #0 added at %s:6]
22prompt> [Breakpoint #0 at %s:6, hits: 1]
23>00006: $a[0] = 2;
24 00007:
25 00008: $a = [0 => 3, 1 => 4];
26prompt> [Added watchpoint #0 for $a[]]
27prompt> [Breaking on watchpoint $a[]]
281 elements were added to the array
29>00009:
30prompt> [$a[] has been removed, removing watchpoint]
31[Script ended normally]
32prompt>
33--FILE--
34<?php
35
36$a = [];
37
38$a[0] = 1;
39$a[0] = 2;
40
41$a = [0 => 3, 1 => 4];
42