php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73927 phpdbg fails with windows error prompt at "watch array"
Submitted: 2017-01-13 14:28 UTC Modified: 2020-05-25 22:58 UTC
From: stahlstift at gmail dot com Assigned: cmb (profile)
Status: Closed Package: phpdbg
PHP Version: 7.0.14 OS: Windows 10 Pro
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: stahlstift at gmail dot com
New email:
PHP Version: OS:

 

 [2017-01-13 14:28 UTC] stahlstift at gmail dot com
Description:
------------
C:\Users\username\PhpstormProjects\phpdbg>phpdbg
[Welcome to phpdbg, the interactive PHP debugger, v0.5.0]
To get help using phpdbg type "help" and press enter
[Please report bugs to <http://bugs.php.net/report.php>]
prompt> e test.php
[Set execution context: C:\Users\username\PhpstormProjects\phpdbg\test.php]
[Successful compilation of C:\Users\username\PhpstormProjects\phpdbg\test.php]
prompt> l 20
 00001: <?php
 00002:
 00003: // Generate some mock data
 00004: $example = [1, 23, 23423, 256436, 3463, 4363, 457];
 00005: foreach (range(1, 1000) as $val) {
 00006:     $example[] = mt_rand(1, 10000);
 00007: }
 00008:
 00009: // Stuff to debug
 00010: function doCoolStuff($value)
 00011: {
 00012:     $value++;
 00013:
 00014:     return mt_rand(1, 1000);
 00015: }
 00016:
 00017: $lower = [];
 00018: foreach ($example as $key => $value) {
 00019:     if ($value < 100) {
 00020:         $lower[] = $value;
prompt> b 19
[Breakpoint #0 added at C:\Users\username\PhpstormProjects\phpdbg\test.php:19]
prompt> r
[Breakpoint #0 at C:\Users\username\PhpstormProjects\phpdbg\test.php:19, hits: 1]
>00019:     if ($value < 100) {
 00020:         $lower[] = $value;
 00021:     } else {
prompt> c
[Breakpoint #0 at C:\Users\username\PhpstormProjects\phpdbg\test.php:19, hits: 2]
>00019:     if ($value < 100) {
 00020:         $lower[] = $value;
 00021:     } else {
prompt> w $value
[Set watchpoint on $value]
prompt> w $lower[]

Test script:
---------------
<?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);
    }
}



Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-16 04:34 UTC] krakjoe@php.net
-Assigned To: +Assigned To: bwoebi
 [2018-06-23 13:58 UTC] cmb@php.net
The given reproduce script results in a segfault on Debian with
current master (e03739d4ab46b234709bdaa29280e16af94884c4):

Program received signal SIGSEGV, Segmentation fault.
0x00005555559da136 in zval_get_type (pz=0x1)
    at /parent/php-src/Zend/zend_types.h:412
412             return pz->u1.v.type;
(gdb) bt
#0  0x00005555559da136 in zval_get_type (pz=0x1)
    at /parent/php-src/Zend/zend_types.h:412
#1  0x00005555559db36b in phpdbg_parse_variable_with_arg (
    input=0x7ffff68010f0 "$lower[]", len=8, parent=0x7ffff68652a0, i=7,
    callback=0x5555559e8319 <phpdbg_watchpoint_parse_wrapper>,
    step_cb=0x5555559e8585 <phpdbg_watchpoint_parse_step>, silent=0 '\000',
    arg=0x7fffffffd1f0) at /parent/php-src/sapi/phpdbg/phpdbg_utils.c:474
#2  0x00005555559e88b9 in phpdbg_watchpoint_parse_symtables (
    input=0x7ffff68010f0 "$lower[]", len=8,
    callback=0x5555559e8155 <phpdbg_create_simple_watchpoint>)
    at /parent/php-src/sapi/phpdbg/phpdbg_watch.c:1317
#3  0x00005555559e8a04 in phpdbg_create_var_watchpoint (
    input=0x7ffff68010f0 "$lower[]", len=8)
    at /parent/php-src/sapi/phpdbg/phpdbg_watch.c:1347
#4  0x00005555559ce016 in phpdbg_do_watch (param=0x555555eb9310)
    at /parent/php-src/sapi/phpdbg/phpdbg_prompt.c:1594
#5  0x00005555559e1c3f in phpdbg_internal_stack_execute (stack=0x7fffffffd2d0,
    allow_async_unsafe=1 '\001')
    at /parent/php-src/sapi/phpdbg/phpdbg_cmd.c:703
#6  0x00005555559e1d32 in phpdbg_stack_execute (stack=0x7fffffffd2d0,
    allow_async_unsafe=1 '\001')
    at /parent/php-src/sapi/phpdbg/phpdbg_cmd.c:733
#7  0x00005555559ce163 in phpdbg_interactive (allow_async_unsafe=1 '\001',
    input=0x7ffff68010c0 "w $lower[]\n")
    at /parent/php-src/sapi/phpdbg/phpdbg_prompt.c:1631
#8  0x00005555559cf15d in phpdbg_execute_ex (execute_data=0x7ffff6821030)
    at /parent/php-src/sapi/phpdbg/phpdbg_prompt.c:1877
#9  0x00005555559bcb47 in zend_execute (op_array=0x7ffff686f400,
    return_value=0x555555e6afe0 <phpdbg_globals+1344>)
    at /parent/php-src/Zend/zend_vm_execute.h:59961
#10 0x00005555559cbd57 in phpdbg_do_run (param=0x0)
    at /parent/php-src/sapi/phpdbg/phpdbg_prompt.c:942
#11 0x00005555559e1c3f in phpdbg_internal_stack_execute (stack=0x7fffffffd7e0,
    allow_async_unsafe=1 '\001')
    at /parent/php-src/sapi/phpdbg/phpdbg_cmd.c:703
#12 0x00005555559e1d32 in phpdbg_stack_execute (stack=0x7fffffffd7e0,
    allow_async_unsafe=1 '\001')
    at /parent/php-src/sapi/phpdbg/phpdbg_cmd.c:733
#13 0x00005555559ce163 in phpdbg_interactive (allow_async_unsafe=1 '\001',
    input=0x7ffff6804050 "r\n")
    at /parent/php-src/sapi/phpdbg/phpdbg_prompt.c:1631
#14 0x00005555559c2e8e in main (argc=1, argv=0x7fffffffe648)
    at /parent/php-src/sapi/phpdbg/phpdbg.c:2008
 [2018-06-23 14:20 UTC] cmb@php.net
Basically the same segfault with PHP-7.1.
 [2020-05-25 22:58 UTC] cmb@php.net
-Status: Assigned +Status: Verified -Assigned To: bwoebi +Assigned To: cmb
 [2020-05-26 17:24 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #73927: phpdbg fails with windows error prompt at "watch array"
On GitHub:  https://github.com/php/php-src/pull/5630
Patch:      https://github.com/php/php-src/pull/5630.patch
 [2020-06-02 13:20 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=af4a9bf1bf9109714e0e45aaf907e9809abb6217
Log: Fix #73927: phpdbg fails with windows error prompt at &quot;watch array&quot;
 [2020-06-02 13:20 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC