File: bug73927.phpt

package info (click to toggle)
php8.4 8.4.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208,108 kB
  • sloc: ansic: 1,060,628; php: 35,345; sh: 11,866; cpp: 7,201; pascal: 4,913; javascript: 3,091; asm: 2,810; yacc: 2,411; makefile: 689; xml: 446; python: 301; awk: 148
file content (57 lines) | stat: -rw-r--r-- 1,171 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--TEST--
Bug #73927 (phpdbg fails with windows error prompt at "watch array")
--SKIPIF--
<?php
if (getenv('SKIP_ASAN')) {
    die("skip intentionally causes segfaults");
}
?>
--PHPDBG--
b 19
r
c
w $value
w $lower[]
q
--EXPECTF--
[Successful compilation of %s]
prompt> [Breakpoint #0 added at %s:%d]
prompt> [Breakpoint #0 at %s:%d, hits: 1]
>00019:     if ($value < 100) {
 00020:         $lower[] = $value;
 00021:     } else {
prompt> [Breakpoint #0 at %s:%d, hits: 2]
>00019:     if ($value < 100) {
 00020:         $lower[] = $value;
 00021:     } else {
prompt> [Added watchpoint #0 for $value]
prompt> [Added watchpoint #1 for $lower[0]]
prompt> [$lower[0] has been removed, removing watchpoint]
[$value has been removed, removing watchpoint]
--FILE--
<?php

// Generate some mock data
$example = [1, 23, 23423, 256436, 3463, 4363, 457];
foreach (range(1, 1000) as $val) {
    $example[] = mt_rand(1, 10000);
}

// Stuff to debug
function doCoolStuff($value)
{
    $value++;

    return mt_rand(1, 1000);
}

$lower = [];
foreach ($example as $key => $value) {
    if ($value < 100) {
        $lower[] = $value;
    } else {
        doCoolStuff($value);
    }
}

?>