question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid XML with PHP anonymous class

See original GitHub issue

Hello 👋

I would like to know if there’s an update regarding the pre-parsing sanitization @joonty ?

I’ve run into an issue similar to #60 today, the parsed xml is:

<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="17" context="0">
    <property name="$deferred" fullname="$deferred" type="object" classname="Amp\Deferred" children="1" numchildren="2" page="0" pagesize="32">
        <property name="resolver" fullname="$deferred-&gt;resolver" facet="private" type="object" classname="class@anonymous&#0;/app/vendor/amphp/amp/lib/Deferred.php0x7fa0c40e72d3" children="1" numchildren="4">
        </property>
        <property name="promise" fullname="$deferred-&gt;promise" facet="private" type="object" classname="Amp\Internal\PrivatePromise" children="1" numchildren="1">
        </property>
    </property>
</response>

which is invalid (because of “invalid character number” &#0;).

The full vdebug error trace is:

- [ERROR] {Tue 17 2018 13:05:36} An error occured: <class 'xml.etree.ElementTree.ParseError'>
Traceback (most recent call last):
  File "/home/gildas/.vim/plugged/vdebug/pythonx/vdebug/event.py", line 524, in dispatch_event
    Dispatcher.events[name](self.__session_handler).run(*args)
  File "/home/gildas/.vim/plugged/vdebug/pythonx/vdebug/event.py", line 439, in run
    self.ui.windows.watch().accept_renderer(rend)
  File "/home/gildas/.vim/plugged/vdebug/pythonx/vdebug/ui/vimui.py", line 513, in accept_renderer
    self.write(renderer.render())
  File "/home/gildas/.vim/plugged/vdebug/pythonx/vdebug/ui/vimui.py", line 736, in render
    properties = self.response.get_context()
  File "/home/gildas/.vim/plugged/vdebug/pythonx/vdebug/dbgp.py", line 132, in get_context
    for c in list(self.as_xml()):
  File "<string>", line None
xml.etree.ElementTree.ParseError: reference to invalid character number: line 2, column 397

And here’s the PHP version I’m using:

PHP 7.2.3 (cli) (built: Mar  5 2018 21:28:31) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

I’m using version 2.0.0 of Vdebug.

Sorry if this has been issued before, I haven’t found any reference to it.

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Taluucommented, Mar 9, 2020

Just had this problem, and fixed with the config proposed by @gquemener. Making this as the default should be the way to go imo.

1reaction
derickrcommented, Jul 20, 2018

I would suggest to make that a default setting, if vdebug supports it, that is.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Anonymous classes - Manual
Anonymous classes ¶​​ Anonymous classes are useful when simple, one-off objects need to be created. All objects created by the same anonymous class...
Read more >
PHP - Processing Invalid XML
This creates and issue because SimpleXML with php just fails, and I don't really know of any good way to handle parsing invalid...
Read more >
namespace prefix xsi for type on XXX is not defined
On aug.4.2011 I'v updated my working copy of PHP-client lib from the svn-repository http://google-api-adwords-php.googlecode.com/svn/trunk/.
Read more >
Documentation: 9.1: XML Functions
The function xmlcomment creates an XML value containing an XML comment with the specified text as content. The text cannot contain "--" or...
Read more >
How to Create Service Aliases and Mark Services as Private
The following example shows how to inject an anonymous service into another service: YAML; XML; PHP. Copy. 1 2 3 4 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found