View Issue Details

IDProjectCategoryView StatusLast Update
0002049XdebugStep Debuggingpublic2022-02-01 16:34
ReporterZobo Assigned Toderick  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version3.1.2 
Fixed in Version3.1.3 
Summary0002049: evaling broken code (still) causes unhandled exception in PHP 7.4
Description

This issue is directly related https://bugs.xdebug.org/view.php?id=1993 .
The fix works well on PHP 8, but not on PHP 7.4 and before.
Specifically placing the text "namespace" in VS Code watch - thus executing eval namespace breaks following step operation.

Steps To Reproduce

Crate file

<?php

xdebug_break();
echo "1";
echo "2";

Stop execution on breakpoint and run eval. Step next and it sould

eval -i 17 -- bmFtZXNwYWNl
<?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="eval" transaction_id="17" status="break" reason="ok"><error code="206"><message><![CDATA[error evaluating code]]></message></error></response>

step_over -i 21
<?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="step_over" transaction_id="21" status="stopping" reason="ok"></response>

Additional Information

Fix tested on PHP 7.4.3

Provided https://github.com/xdebug/xdebug/pull/811
Related https://github.com/xdebug/vscode-php-debug/issues/692

TagsNo tags attached.
Operating SystemWin, Linux...
PHP Version7.4.20-7.4.29

Activities

derick

2021-12-08 17:47

administrator   ~0006173

I can't reproduce this with the information provided: https://github.com/xdebug/xdebug/pull/812 — Can you provide the full xdebug log and script that you use please?

Zobo

2021-12-08 21:42

reporter   ~0006174

Here is the, code, xd2.log that show stepping through it without executing evaluate, and xd3.log that adds the eval command in the middle. See the lineno in stack, how it jumps to 0.

xd3.log (5,683 bytes)   
[33708] Log opened at 2021-12-08 21:37:01.962513
[33708] [Step Debug] INFO: Connecting to configured address/port: localhost:51831.
[33708] [Step Debug] INFO: Connected to debugging client: localhost:51831 (through xdebug.client_host/xdebug.client_port). :-)
[33708] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" language="PHP" xdebug:language_version="7.4.26" protocol_version="1.0" appid="33708"><engine version="3.1.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>

[33708] [Step Debug] <- feature_set -i 1 -n resolved_breakpoints -v 1
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="resolved_breakpoints" success="1"></response>

[33708] [Step Debug] <- feature_set -i 2 -n notify_ok -v 1
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="notify_ok" success="1"></response>

[33708] [Step Debug] <- feature_set -i 3 -n extended_properties -v 1
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="extended_properties" success="1"></response>

[33708] [Step Debug] <- run -i 4
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="5"></xdebug:message></response>

[33708] [Step Debug] <- stack_get -i 5
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="5"><stack where="{main}" level="0" type="file" filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="5"></stack></response>

[33708] [Step Debug] <- context_names -i 6 -d 0
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="6"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>

[33708] [Step Debug] <- context_get -i 7 -d 0 -c 0
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="7" context="0"></response>

[33708] [Step Debug] <- eval -i 8 -- bmFtZXNwYWNl
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="8" status="break" reason="ok"><error code="206"><message><![CDATA[error evaluating code]]></message></error></response>

[33708] [Step Debug] <- context_names -i 9 -d 0
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="9"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>

[33708] [Step Debug] <- context_get -i 10 -d 0 -c 0
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="10" context="0"></response>

[33708] [Step Debug] <- step_over -i 11
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_over" transaction_id="11" status="break" reason="ok"><xdebug:message filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="5"></xdebug:message></response>

[33708] [Step Debug] <- stack_get -i 12
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="12"><stack where="{main}" level="0" type="file" filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="0"></stack></response>

[33708] [Step Debug] <- context_names -i 13 -d 0
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="13"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>

[33708] [Step Debug] <- context_get -i 14 -d 0 -c 0
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="14" context="0"></response>

[33708] [Step Debug] <- step_over -i 15
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_over" transaction_id="15" status="stopping" reason="ok"></response>

[33708] [Step Debug] <- stop -i 16
[33708] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stop" transaction_id="16" status="stopped" reason="ok"></response>

[33708] Log closed at 2021-12-08 21:37:08.733266

xd3.log (5,683 bytes)   
xd2.log (7,419 bytes)   
[2792] Log opened at 2021-12-08 21:36:15.213550
[2792] [Step Debug] INFO: Connecting to configured address/port: localhost:62939.
[2792] [Step Debug] INFO: Connected to debugging client: localhost:62939 (through xdebug.client_host/xdebug.client_port). :-)
[2792] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" language="PHP" xdebug:language_version="7.4.26" protocol_version="1.0" appid="2792"><engine version="3.1.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>

[2792] [Step Debug] <- feature_set -i 1 -n resolved_breakpoints -v 1
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="resolved_breakpoints" success="1"></response>

[2792] [Step Debug] <- feature_set -i 2 -n notify_ok -v 1
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="notify_ok" success="1"></response>

[2792] [Step Debug] <- feature_set -i 3 -n extended_properties -v 1
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="extended_properties" success="1"></response>

[2792] [Step Debug] <- run -i 4
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="5"></xdebug:message></response>

[2792] [Step Debug] <- stack_get -i 5
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="5"><stack where="{main}" level="0" type="file" filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="5"></stack></response>

[2792] [Step Debug] <- context_names -i 6 -d 0
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="6"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>

[2792] [Step Debug] <- context_get -i 7 -d 0 -c 0
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="7" context="0"></response>

[2792] [Step Debug] <- step_over -i 8
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_over" transaction_id="8" status="break" reason="ok"><xdebug:message filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="5"></xdebug:message></response>

[2792] [Step Debug] <- stack_get -i 9
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="9"><stack where="{main}" level="0" type="file" filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="5"></stack></response>

[2792] [Step Debug] <- context_names -i 10 -d 0
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="10"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>

[2792] [Step Debug] <- context_get -i 11 -d 0 -c 0
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="11" context="0"></response>

[2792] [Step Debug] <- step_over -i 12
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_over" transaction_id="12" status="break" reason="ok"><xdebug:message filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="6"></xdebug:message></response>

[2792] [Step Debug] <- stack_get -i 13
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="13"><stack where="{main}" level="0" type="file" filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="6"></stack></response>

[2792] [Step Debug] <- context_names -i 14 -d 0
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="14"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>

[2792] [Step Debug] <- context_get -i 15 -d 0 -c 0
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="15" context="0"></response>

[2792] [Step Debug] <- step_over -i 16
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_over" transaction_id="16" status="break" reason="ok"><xdebug:message filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="7"></xdebug:message></response>

[2792] [Step Debug] <- stack_get -i 17
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="17"><stack where="{main}" level="0" type="file" filename="file:///C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/watch2.php" lineno="7"></stack></response>

[2792] [Step Debug] <- context_names -i 18 -d 0
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="18"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>

[2792] [Step Debug] <- context_get -i 19 -d 0 -c 0
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="19" context="0"></response>

[2792] [Step Debug] <- step_over -i 20
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_over" transaction_id="20" status="stopping" reason="ok"></response>

[2792] [Step Debug] <- stop -i 21
[2792] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stop" transaction_id="21" status="stopped" reason="ok"></response>

[2792] Log closed at 2021-12-08 21:36:18.696398

xd2.log (7,419 bytes)   
watch2.php (70 bytes)   
<?php

echo "1";
xdebug_break();
echo "2";
echo "3";
echo "4";
watch2.php (70 bytes)   

derick

2021-12-15 11:29

administrator   ~0006175

https://github.com/xdebug/xdebug/pull/812

derick

2021-12-15 15:31

administrator   ~0006176

Fixed for Xdebug 3.1.3. I've removed the version define check altogether, as it was needed for PHP 7.2 and up, but also had to adjust the patch due to a new compiler warning.

Issue History

Date Modified Username Field Change
2021-12-02 23:28 Zobo New Issue
2021-12-08 17:47 derick Assigned To => derick
2021-12-08 17:47 derick Status new => feedback
2021-12-08 17:47 derick Note Added: 0006173
2021-12-08 21:42 Zobo Note Added: 0006174
2021-12-08 21:42 Zobo File Added: xd3.log
2021-12-08 21:42 Zobo File Added: xd2.log
2021-12-08 21:42 Zobo File Added: watch2.php
2021-12-08 21:42 Zobo Status feedback => assigned
2021-12-15 11:29 derick Note Added: 0006175
2021-12-15 15:31 derick Status assigned => closed
2021-12-15 15:31 derick Resolution open => fixed
2021-12-15 15:31 derick Fixed in Version => 3.2dev
2021-12-15 15:31 derick Note Added: 0006176
2022-02-01 16:34 derick Fixed in Version 3.2dev => 3.1.3