View Issue Details

IDProjectCategoryView StatusLast Update
0002066XdebugStep Debuggingpublic2022-02-22 20:29
Reporterarctgx Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Product Version3.1.2 
Summary0002066: Broken response from evaluation any object of anonymous subclass
Description

Hi,

I cannot use any response from evaluation (both from property_get and eval) any object of anonymous subclass. I started with the problem in nvim DAP client but I see that even dbgpClient cannot use it.

Steps To Reproduce

Please run dbgpClient -x on the test file
https://raw.githubusercontent.com/derickr/xdebug/d494af5d82f62bf3aea986d788f8191f5a3c9f2d/tests/debugger/bug02025.inc
and try
property_get -i 18 -d 0 -c 0 -n "$this"
after stopping at the breakpoint.

<?xml version="1.0" encoding="iso-8859-1"?>
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; fileuri="file:///tmp/bug02025.php" language="PHP" xdebug:language_version="8.1.2" protocol_version="1.0" appid="206740" idekey="xxx"><engine version="3.1.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]>&lt;/url>&lt;copyright>&lt;![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>
DBGp/1.0: Xdebug 3.1.2 — For PHP 8.1.2
Debugging file:///tmp/bug02025.php (ID: 206740/xxx)
(cmd) run
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="run" transaction_id="1" status="break" reason="ok"><xdebug:message filename="dbgp://1" lineno="6"></xdebug:message></response>
1 | run > break/ok
1 | dbgp://1:6

(cmd) property_get -i 18 -d 0 -c 0 -n "$this"
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="property_get" transaction_id="18"><property name="$this" fullname="$this" type="object" classname="foo@anonymous�/tmp/bug02025.php:13$0" children="1" numchildren="1" page="0" pagesize="32"><property name="foo" fullname="$this->foo" facet="protected" type="string" size="3" encoding="base64"><![CDATA[YmFy]]></property></property></response>
Error while handling connection: Could not interpret XML, closing connection.
Disconnect

Additional Information

I have prepared an environment

https://github.com/przepompownia/dap-ui-test

with nvim-dap and vscode-php-debug to show a similar example (make anonymous-class after make start) but running dbgpClient should be sufficient.

Tagsanonymous
Operating SystemDebian Sid
PHP Version8.1.0-8.1.4

Activities

derick

2022-02-22 18:06

administrator   ~0006213

Last edited: 2022-02-22 18:06

Hi,

I can reproduce it, but it is not a bug. The DBGp protocol originally did not expect there to be NULL characters in class names, but PHP does use this. This situation can be handled to enable the ("extended_properties")[https://xdebug.org/docs/dbgp#extended-properties] feature. When enabling this with:

<pre>
feature_set -n extended_properties -v 1
</pre>

Valid XML is returned:

<pre>
<?xml version="1.0" encoding="iso-8859-1"?>
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; fileuri="file:///home/derick/dev/php/derickr-xdebug/tests/debugger/bug02025.inc" language="PHP" xdebug:language_version="8.1.4-dev" protocol_version="1.0" appid="2226691" idekey="yes"><engine version="3.1.4-dev"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]>&lt;/url>&lt;copyright>&lt;![CDATA[Copyright (c) 2002-2022 by Derick Rethans]]></copyright></init>
DBGp/1.0: Xdebug 3.1.4-dev — For PHP 8.1.4-dev
Debugging file:///home/derick/dev/php/derickr-xdebug/tests/debugger/bug02025.inc (ID: 2226691/yes)
(cmd) feature_set -n extended_properties -v 1
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="feature_set" transaction_id="1" feature="extended_properties" success="1"></response>
1 | feature_set
1 | extended_properties: OK

(cmd) run
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="run" transaction_id="2" status="break" reason="ok"><xdebug:message filename="dbgp://1" lineno="6"></xdebug:message></response>
2 | run > break/ok
2 | dbgp://1:6

(cmd) property_get -i 18 -d 0 -c 0 -n $this
<?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="property_get" transaction_id="18"><property type="object" children="1" numchildren="1" page="0" pagesize="32"><name encoding="base64"><![CDATA[JHRoaXM=]]></name><fullname encoding="base64"><![CDATA[JHRoaXM=]]></fullname><classname encoding="base64"><![CDATA[Zm9vQGFub255bW91cwAvaG9tZS9kZXJpY2svZGV2L3BocC9kZXJpY2tyLXhkZWJ1Zy90ZXN0cy9kZWJ1Z2dlci9idWcwMjAyNS5pbmM6MTMkMA==]]></classname><property name="foo" fullname="$this->foo" facet="protected" type="string" size="3" encoding="base64"><![CDATA[YmFy]]></property></property></response>
18 | property_get
18 | object () {
18 | string foo: bar
18 | }
</pre>

cheers,
Derick

arctgx

2022-02-22 20:29

reporter   ~0006219

Hi Derick,

thank you for explaining what is missing in this case.

Maybe there is still something to do on the DAP adapter side - in both cases (enabled and disabled extended_properties).

What do you think about displaying a short tip from dbgpClient about this missing feature (I don't know how much PHP specific can be this tool)?

By the way, the URL from help command leads to non-existent page.

A short overview of commands is also available in the online
documentation at https://xdebug.org/docs/debugclient

Issue History

Date Modified Username Field Change
2022-02-21 18:36 arctgx New Issue
2022-02-21 18:36 arctgx Tag Attached: anonymous
2022-02-22 18:06 derick Assigned To => derick
2022-02-22 18:06 derick Status new => resolved
2022-02-22 18:06 derick Resolution open => no change required
2022-02-22 18:06 derick Note Added: 0006213
2022-02-22 18:06 derick Note Edited: 0006213
2022-02-22 20:29 arctgx Note Added: 0006219