xref: /php-src/sapi/phpdbg/tests/bug73927.phpt (revision 57463cf7)
1--TEST--
2Bug #73927 (phpdbg fails with windows error prompt at "watch array")
3--SKIPIF--
4<?php
5if (getenv('SKIP_ASAN')) {
6    die("skip intentionally causes segfaults");
7}
8?>
9--PHPDBG--
10b 19
11r
12c
13w $value
14w $lower[]
15q
16--EXPECTF--
17[Successful compilation of %s]
18prompt> [Breakpoint #0 added at %s:%d]
19prompt> [Breakpoint #0 at %s:%d, hits: 1]
20>00019:     if ($value < 100) {
21 00020:         $lower[] = $value;
22 00021:     } else {
23prompt> [Breakpoint #0 at %s:%d, hits: 2]
24>00019:     if ($value < 100) {
25 00020:         $lower[] = $value;
26 00021:     } else {
27prompt> [Added watchpoint #0 for $value]
28prompt> [Added watchpoint #1 for $lower[0]]
29prompt> [$lower[0] has been removed, removing watchpoint]
30[$value has been removed, removing watchpoint]
31--FILE--
32<?php
33
34// Generate some mock data
35$example = [1, 23, 23423, 256436, 3463, 4363, 457];
36foreach (range(1, 1000) as $val) {
37    $example[] = mt_rand(1, 10000);
38}
39
40// Stuff to debug
41function doCoolStuff($value)
42{
43    $value++;
44
45    return mt_rand(1, 1000);
46}
47
48$lower = [];
49foreach ($example as $key => $value) {
50    if ($value < 100) {
51        $lower[] = $value;
52    } else {
53        doCoolStuff($value);
54    }
55}
56
57?>
58