martomo / SublimeTextXdebug

Xdebug debugger client for Sublime Text
MIT License
564 stars 89 forks source link

Xdebug Console Error When Reading Context #184

Closed jg314 closed 4 years ago

jg314 commented 6 years ago

The Xdebug Context is never populated because there is an error (xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 2, column 572) when trying to read the context value from Xdebug. I see the issue https://github.com/martomo/SublimeTextXdebug/issues/172, but I tried turning off super globals as well as switching to three different versions of Xdebug. None of those seemed to do the trick.

I've done my best to debug this myself, but after many hours I've come up short. If anyone has any suggestions I'd love to hear them. I've included the details of my setup below.

Environment

Sublime Text

Operating system: Windows 10 Installed version/build: Version 3.1.1, Build 3176 Python version: 3.3.6

Server

Operating system: I'm trying to run the script locally using Wamp. PHP/Xdebug version: PHP: 7.0.10 Xdebug: I have tried 2.5.5, 2.6.0 and 2.7.0alpha

Configuration

php.ini/xdebug.ini

[xdebug]
;zend_extension = c:\wamp\bin\php\php7.0.10\ext\php_xdebug-2.5.5-7.0-vc14-x86_64.dll
;zend_extension = c:\wamp\bin\php\php7.0.10\ext\php_xdebug-2.6.0-7.0-vc14-x86_64.dll
zend_extension = c:\wamp\bin\php\php7.0.10\ext\php_xdebug-2.7.0alpha1-7.0-vc14-x86_64.dll

xdebug.remote_enable = 1
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = req
xdebug.remote_connect_back = 0
xdebug.remote_autostart = 0
xdebug.remote_log = C:/wamp/logs/xdebug.log

xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = On
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/wamp/tmp"
xdebug.show_local_vars=0
# ...

Packages/User/Xdebug.sublime-settings

{

    "debug": true,
    "super_globals": false,

}

*.sublime-project

{
    "folders":
    [
        {
            "path": "."
        }
    ],
    "settings": {
        "xdebug": {
             "url": "http://localhost/wiredwebsites/",
             "path_mapping": {
                "C:\\wamp\\www\\wiredwebsites\\" : "C:/wamp/www/wiredwebsites/",
          },
        }
    }
}

Logs

Console output:

Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "C:\Users\......\AppData\Roaming\Sublime Text 3\Installed Packages\Xdebug Client.sublime-package\xdebug/session.py", line 148, in run
    self.execute(self.get_option('command'))
  File "C:\Users\......\AppData\Roaming\Sublime Text 3\Installed Packages\Xdebug Client.sublime-package\xdebug/session.py", line 240, in execute
    context = self.get_context_values()
  File "C:\Users\......\AppData\Roaming\Sublime Text 3\Installed Packages\Xdebug Client.sublime-package\xdebug/session.py", line 276, in get_context_values
    response = S.SESSION.read()
  File "C:\Users\......\AppData\Roaming\Sublime Text 3\Installed Packages\Xdebug Client.sublime-package\xdebug/protocol.py", line 195, in read
    document = ET.fromstring(data)
  File "./python3.3/xml/etree/ElementTree.py", line 1356, in XML
  File "<string>", line None
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 2, column 572

Packages/User/Xdebug.log: I'm not including this because the contents is huge, but let me know if you need this information.

rajeebbanstola commented 6 years ago

I'm getting the same error.

@jg314 Did you manage to get it working?

jg314 commented 6 years ago

@RajeebTheGreat, sadly I haven't been able to solve it. It seems like a bug with the package itself, so the developer would most likely need to get involved.

If you haven't already I'd recommend checking out issue #172. There are some other suggestions in there that are worth trying.

Good luck and let me know if you find a solution.

donotnoot commented 6 years ago

Exact same error here. Tried with Xdebug 2.5.5, 2.60 and 2.7.0-alpha. macOS HS.

mercurykd commented 6 years ago

@martomo come back , please(

mercurykd commented 6 years ago

protocol.py after line 135 paste this: elif text[1:-1] == 'quot': text = "'"

donotnoot commented 6 years ago

@mercurykd if you really, really need to do some debugging and cannot wait for the maintainers of this repo to fix this issue, I suggest you try pugdebug, it's really cool.

Granted, you will have to change windows to Pugdebug to set breakpoints and debug the code, but it's a complete, proper front-end for Xdebug. 👍

mercurykd commented 6 years ago

@donotnoot I myself fixed, sublime-package is the same zip-archive. everything is working

stychos commented 6 years ago

@mercurykd Thanks a lot!

RM4LA commented 6 years ago

@mercurykd , thanks tried to insert your code into protocol.py :

135 pass 136 elif text[1:-1] == 'quot': 137 text = "'" 138 else:

but after SublimeTextXdebug not working at all(even menu is grey)

what i didnt got?

mercurykd commented 6 years ago

@RM4LA the syntax error is most likely, under me windows10x64 all worked correctly

RM4LA commented 6 years ago

@mercurykd, i tested on Window7x64, could you please describe with more details witch file you edited ? I edited "Xdebug Client.sublime-package" in ...\Sublime Text 3\Installed Packages"

mercurykd commented 6 years ago

@RM4LA I renamed the extension to zip from Xdebug Client.sublime-package, unpacked it, inserted the changes in the xdebug / protocol.py file, packed it back into zip, and renamed it back to Xdebug Client.sublime-package. Move to sublime folder image

RM4LA commented 6 years ago

@mercurykd thanks a lot your code is working great

jebbdomingo commented 5 years ago

@mercurykd xdebug client doesn't work when the source code to debug is symlinked to the project folder

alailsonribeiro commented 5 years ago

Working Fine To me!

@RM4LA I renamed the extension to zip from Xdebug Client.sublime-package, unpacked it, inserted the changes in the xdebug / protocol.py file, packed it back into zip, and renamed it back to Xdebug Client.sublime-package. Move to sublime folder image

x558li commented 5 years ago

@mercurykd I changed the file as what you said. The menu turned grey. I'm running on Ubuntu 16.04. What might be a possible syntax error?

aolin480 commented 4 years ago

protocol.py after line 135 paste this: elif text[1:-1] == 'quot': text = "'"

@mercurykd what's your BTC address for donations 😂 This worked! After a restart of Sublime Text

martomo commented 4 years ago

Closing this issue as this should be resolved with release 1.1.2, in case the issue was not resolved please let me know.