Home > Back-end >  Cannot step xdebug with NetBeans since php 8
Cannot step xdebug with NetBeans since php 8

Time:09-25

Since upgrading from php 7 to php 8, I can no longer Step Into/Step Over/Continue with NetBeans IDE 11.0 and xdebug 3.0.4.

xdebug (via NetBeans) is configured to "Stop at First Line" - and this works. That is, the (local host) web page is suspended, and the NetBeans Step Into/Step Over/Continue buttons are enabled. But, when I click any of Step Into/Step Over/Continue, the xdebug session is closed, and NetBeans no longer prompts. Additionally, the web page completes - but without any output.

There's nothing related in syslog. The php8.0-fpm.log shows no errors. The xdebug.log file is below.

Is there any other log I should be looking at?

[60811] Log opened at 2021-09-24 13:17:34.836984
[60811] [Step Debug] INFO: Checking remote connect back address.
[60811] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[60811] [Step Debug] INFO: Checking header 'REMOTE_ADDR'.
[60811] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 127.0.0.1:7070.
[60811] [Step Debug] INFO: Connected to debugging client: 127.0.0.1:7070 (from REMOTE_ADDR HTTP header). :-)
[60811] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///home/flymike/critical_data/http/sarabayracing.home/index.php" language="PHP" xdebug:language_version="8.0.5" protocol_version="1.0" appid="60811" idekey="netbeans-xdebug"><engine version="3.0.4"><![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>

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

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

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

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

[60811] [Step Debug] <- breakpoint_set -i 36 -t line -s enabled -f file:///home/flymike/critical_data/http/sarabayracing.home/wp-content/plugins/MJH/EventRegistration/Archive/1.12/classes/time_period.php -n 24
[60811] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="36" state="enabled" id="608110001"></response>

[60811] [Step Debug] <- breakpoint_set -i 37 -t line -s enabled -f file:///home/flymike/critical_data/http/sarabayracing.home/wp-content/plugins/MJH/EventRegistration/classes/EventRegistration.php -n 113
[60811] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="37" state="enabled" id="608110002"></response>

[60811] [Step Debug] <- breakpoint_set -i 38 -t line -s enabled -f file:///home/flymike/critical_data/http/sarabayracing.home/wp-content/plugins/MJH/EventRegistration/Archive/1.12/classes/time_period.php -n 89
[60811] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="38" state="enabled" id="608110003"></response>

[60811] [Step Debug] <- stdout -i 39 -c 1
[60811] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="39" success="1"></response>

[60811] [Step Debug] <- step_into -i 40
[60811] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="40" status="break" reason="ok"><xdebug:message filename="file:///home/flymike/critical_data/http/sarabayracing.home/index.php" lineno="14"></xdebug:message></response>

[60811] [Step Debug] <- stack_get -i 41
[60811] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="41"><stack where="{main}" level="0" type="file" filename="file:///home/flymike/critical_data/http/sarabayracing.home/index.php" lineno="14"></stack></response>

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

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

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

[60811] [Step Debug] <- context_get -i 45 -c 1
[60811] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="45" context="1"><property name="$_COOKIE" fullname="$_COOKIE" type="array" children="1" numchildren="6" page="0" pagesize="30"><property name="wp-settings-1" fullname="$_COOKIE[&quot;wp-settings-1&quot;]" type="string" size="76" encoding="base64"><![CDATA[bGlicmFyeUNvbnRlbnQ9YnJvd3NlJmhpZGV0Yj0xJmVkaXRvcj1odG1sJmVkaXRvcl9wbGFpbl90ZXh0X3Bhc3RlX3dhcm5pbmc9Mg==]]></property><proper
[60811] [Step Debug] <- context_get -i 46 -c 2
[60811] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="46" context="2"></response>

[60811] [Step Debug] <- step_into -i 47
[60811] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[Q29udGVudC10eXBlOiB0ZXh0L2h0bWw7IGNoYXJzZXQ9VVRGLTg=]]></stream>

[60811] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[DQo=]]></stream>

[60811] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[DQo=]]></stream>

[60811] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="47" status="stopping" reason="ok"></response>

[60811] Log closed at 2021-09-24 13:17:40.814767

CodePudding user response:

There are some changes between PHP 7.4 and 8.0, which change the behaviour of error checking for internal eval statements, which Xdebug uses when an IDE sets a watch.

If I base64 decode your (or rather the IDE's) eval statement (eval -i 43 -- KFxnZXRfb3B0aW9uKHNlbGY6OiRTRVRUSU5HU19OQU1FKQ==), it says:

(\get_option(self::$SETTINGS_NAME)                                               

There is an extra ( at the start, most likely in a watch that you've set?

Xdebug 3.1 should have a fix for the changes to eval, and you can test this for yourself by installing Xdebug 3.1.0beta2, from either PECL (pecl install xdebug-3.1.0beta2) or from source code.

  • Related