Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xdebug Console Error When Reading Context #184

Closed
jg314 opened this issue May 16, 2018 · 18 comments
Closed

Xdebug Console Error When Reading Context #184

jg314 opened this issue May 16, 2018 · 18 comments
Labels

Comments

@jg314
Copy link

jg314 commented May 16, 2018

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 #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
Copy link

I'm getting the same error.

@jg314 Did you manage to get it working?

@jg314
Copy link
Author

jg314 commented Jun 4, 2018

@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
Copy link

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

@mercurykd
Copy link

@martomo come back , please(

@mercurykd
Copy link

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

@donotnoot
Copy link

@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
Copy link

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

@stychos
Copy link

stychos commented Aug 9, 2018

@mercurykd Thanks a lot!

@RM4LA
Copy link

RM4LA commented Aug 11, 2018

@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
Copy link

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

@RM4LA
Copy link

RM4LA commented Aug 11, 2018

@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
Copy link

@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
Copy link

RM4LA commented Aug 12, 2018

@mercurykd thanks a lot
your code is working great

@jebbdomingo
Copy link

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

@alailsonribeiro
Copy link

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
Copy link

x558li commented Mar 29, 2019

@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
Copy link

aolin480 commented Nov 1, 2019

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
Copy link
Owner

martomo commented Nov 30, 2019

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

@martomo martomo closed this as completed Nov 30, 2019
@martomo martomo added the bug label Nov 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests