martomo / SublimeTextXdebug

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

Xdebug Context blank #172

Closed zono50 closed 4 years ago

zono50 commented 7 years ago

I have been working on this issue for about a week now. I have Xdebug show up in phpinfo, all the modules are loaded correctly. I'm trying to run Xdebug on localhost. The port i'm using for xdebug is open, yet xdebug always shows blank on Xdebug Context, where before it would show data about the session. Any help on this would be great.

Here is my Xdebug.ini

[xdebug] zend_extension="/etc/php/conf.d/xdebug.so" xdebug.remote_enable=1 xdebug.remote_host="127.0.0.1" xdebug.remote_port=9000 xdebug.remote_handler="dbgp" xdebug.remote_log="/Backup/xdebug.log" xdebug.remote_mode = req xdebug.remote_connect_back = 1 xdebug.idekey=sublime.xdebug

and my xdebug files.

Assignment1.sublime-project -

{

"folders":
[
    {

        "follow_symlinks": true,
        "path": "."

    }

],

"settings": {

    "xdebug": {
        "path_mapping": {
    "/srv/http/Assignment1.php" : "/srv/http/Assignment1.php",

},

        "url": "http://localhost/Assignment1.php",
        "ide_key": "sublime.xdebug",
        "port": 9000,
        "super_globals": true

    }

}

}

Xdebug.sublime-settings -

{
"path_mapping": { "/srv/http/Assignment1.php" : "/srv/http/Assignment1.php",

},

"url": "http://localhost/Assignment1.php",
"super_globals": true,
"close_on_stop": true

}

albionbrown commented 7 years ago

I have the same issue with the following xdebug.sublime-settings { "max_depth": 10, "max_children": 64, "max_data": 4096, "super_globals": false }

Any update on this?

dschiera95 commented 7 years ago

@joshbrown81, I was having this same problem too. Weird thing is that different projects behave differently. On the project where the Xdebug Context was blank, I updated the "max-depth" from 3 to 1, and then it worked.

johnwilhite commented 6 years ago

I had this problem on one of my virtual machines, and I was able to figure out that it was on a dev version of XDebug that wasn't properly escaping xml quotes. Downgrading to latest stable version fixed the issue.

soifou commented 6 years ago

I have the same problem and I think it is a bug with Xdebug not this package

I looked at xdebug.log for both version and as @jbwilhite said it is a problem about escaping xml quotes

Xdebug 2.6.0 return this (looked at the fullname property not escaping correctly):

<response command="context_get" context="1" transaction_id="16" xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug">
    <property children="1" fullname="$_COOKIE" name="$_COOKIE" numchildren="2" page="0" pagesize="32" type="array">
        <property encoding="base64" fullname="$_COOKIE[&quot;XDEBUG_SESSION&quot;]" name="XDEBUG_SESSION" size="14" type="string">
            <![CDATA[c3VibGltZS54ZGVidWc=]]>
        </property>
        [...]
    </property>
[...]
</response>

Instead of this (Xdebug 2.5.5)

<response command="context_get" context="1" transaction_id="16" xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug">
    <property children="1" fullname="$_COOKIE" name="$_COOKIE" numchildren="2" page="0" pagesize="32" type="array">
        <property encoding="base64" fullname="$_COOKIE['XDEBUG_SESSION']" name="XDEBUG_SESSION" size="14" type="string">
            <![CDATA[c3VibGltZS54ZGVidWc=]]>
        </property>
        [...]
    </property>
[...]
</response>
adc91 commented 6 years ago

There is an error when parsing the XML when the super_globals field is true. The solution for now is to put super_globals in false.

In Sublime click Tool -> Xdebug -> Settings - User

{
    "super_globals": false,
}
megusta420 commented 6 years ago

@martomo hello! Will it be the update for xdebug >=2.60? I have the same issue as people above, see no any local variables, just variables passed through parameters to the function:

image image

tealborder commented 6 years ago

Super_globals toggling doesnt do anything for me. I'm on Debian contrib-stretch64, php7.2, opcache turned off

PHP 7.2.4-1+0~20180405085422.20+stretch~1.gbpbff9f0 (cli) (built: Apr  5 2018 08:54:25) ( NTS )
...
Zend Engine v3.2.0, ...
    with Zend OPcache v7.2.4-1+0~20180405085422.20+stretch~1.gbpbff9f0, ...
    with Xdebug v2.6.0, ...

Reported as issue at xdebug tracker. Total noob here if I'm doing this wrong https://bugs.xdebug.org/view.php?id=1550

So double quote is translated to quote; here https://github.com/martomo/SublimeTextXdebug/blob/master/xdebug/elementtree/ElementTree.py Lines 761, 822

albionbrown commented 6 years ago

I found after some experimenting, that the max_depth can be a culprit. I decreased mine from 10 to 4 to begin with and the context variables began to appear again. Now, mine sits at 8 and I haven't had an issue since. (MacBook pro, VS Code, has worked with PHP 5.5, 5.6 and 7.1)

"xdebugSettings": { "max_children": 4096, "max_data": 268435456, "max_depth": 8 }

I think it can really struggle when you have, say a large multidimensional array.

madebycaliper commented 6 years ago

I really don't know enough about Python or ST3's inner workings to know what's happening but it seems like it might be related to the loading the context into memory. The breakpoint/error line will get focused in the editor window but then xdebug seems to "freeze" and not populate or update the context/watch windows.

BigsonLvrocha commented 6 years ago

I also get this error, using it in windows 7 with globals set to false and max_depth > 1 and even that, when I get the stack call higher than 8 the context gets blank

longelas commented 6 years ago

Until martomo solves this issue with the plugin, I advise you all to switch to atom instead of sublime and install the php-debug package for it. Also, almost all sublime plugins has an atom substitute and debugging in atom just works fine with xdebug 2.6.0+. Not the ideal solution, but still a better option than seeing nothing in the context window.

mkd1994 commented 6 years ago

XDebug Settings: max_depth: 1 and superglobals: false and it works with no issues, if you ask me why i dont know ... --

orchie commented 6 years ago

xdebug 2.6 , set super_globals = false ,in users.setting then its ok.

johnpicozzi commented 6 years ago

Having the same issue and "max_depth": 1, & "super_globals": false did not work. Strange thing is my breakpoints still work, I can get xdebug to connect and stop at breakpoints. Just no info in any of the windows.

albionbrown commented 6 years ago

@johnpicozzi What about your max data and max children? I found it's best to try and start with the absolute minimum and then slowly work up to see how far you can stretch it.

I switched to VS code some time ago now and still haven't had an issue like this just fyi.

johnpicozzi commented 6 years ago

@joshbrown81 - Those are both set to default.

LOL - My co-workers recommended that. Maybe I will give that a go

darby3 commented 6 years ago

I think I tried the stretch-up approach myself and never got anywhere with it. Getting minimal versions of Drupal arrays wouldn't be of much use (to me) in any case.

albionbrown commented 6 years ago

@darby3 Yeah, especially when you get arrays full of objects that contain more arrays! @johnpicozzi My reaction was the same when a colleague of mine suggested. I was very uncertain at first but I can honestly say it's made my development so much easier, especially with xdebug.

mercurykd commented 6 years ago

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

rioastamal commented 6 years ago

@mercurykd Thanks. I've made PR based on your code https://github.com/martomo/SublimeTextXdebug/pull/186

andresmrg commented 5 years ago

FINALLY WORKING!

This is needed so urgent! We are just struggling to get this working... After several hours I finally came here to see the problem was not my xdebug installation, neither a configuration issue.

On High Sierra: For those who super_globals = false didn't work and max_depth = 1 (my case). Here is what I did.

  1. I uninstall xdebug client for sublime text
  2. I download the repository from the instructions https://github.com/martomo/SublimeTextXdebug#installation
  3. Edited the file as suggested https://github.com/martomo/SublimeTextXdebug/issues/184
  4. On sublimeText, Preference > Browse Packages and move the folder there. Quit Sublime and Open it again.
  5. It works now.

I hope these instructions just help a newbie like me.

stychos commented 5 years ago

But there's another issue for me, I don't know how to look at the multi-level arrays content from context. screen shot 2018-09-08 at 12 48 29 pm Any solution? But I think better to create new issue for this, will try to fix it first myself.

andresmrg commented 5 years ago

That's not an issue. Open Sublime and go to Tool > Xdebug > Setting - User and update max_depth to any number > 2. The default settings use 1, so you should work with a number over 3, the larger the number, the longer it will take while debugging. After you apply the changes, close sublime and open it again, they should have taken effect. @stychos

{
  "max_depth": 6,

  // Maximum amount of array children
  // and object's properties to return.
  "max_children": 50,

  // Maximum amount of
  // variable data to initially retrieve.
  "max_data": 5048,
}
stychos commented 5 years ago

Hm.. this time it's worked. I could been sure that when last time I've tried it (before this "quot" fix), it wasn't worked for me. Getting my words back. Thank you!

am3000 commented 5 years ago

I´m having this bug with PHP 7.29 super_globals = false worked But I want to see the super_globals Will this bug be fixed soon? Thanks!

becassin commented 5 years ago

I tried the following fixes up WITHOUT success:

Finally had to downgrade xdebug from 2.6.0 back to 2.5.0

meengit commented 5 years ago

@becassin

I have a working fork for me. You can also use if you want.

Installation:

That's it.

Important notes:

holt83 commented 5 years ago

@meengit I followed your instructions using your fork of the xdebug client, but unfortunately it didn't work for me :( I still get the blank context sometimes.

I noticed that it seems to happen for me when the data contains non-ASCII unicode characters.

But it was worth the try! thanks anyway 👍

mkindred commented 5 years ago

Like @meengit I had been working off my own fork. But even that stopped working at some point. I agree that it's probably based on specific characters. Sadly, this became the issue that forced me to leave Sublime for Atom.

meengit commented 5 years ago

Hi @holt83

Sorry for the late response (https://github.com/martomo/SublimeTextXdebug/issues/172#issuecomment-473889358)! I'm under pressure these days.

Do you have an error message or something for me? (Something out of "View" > "Show console").

Just as a hint (maybe you did it): Lately, people contacted me often have forgotten to do the cmd+shift+p > "Package Control: Remove Package Xdebug Client" before doing

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
git clone https://github.com/meengit/SublimeTextXdebug.git "Xdebug Client"

& Sublime restart …

konoknir commented 5 years ago

This error is triggered (xdebug-2.6): "Length mismatch encountered while reading the Xdebug message" I don't know why this is happening, but if you just "return message" at protocol.py:170 without checking content length, everything works...

Edit: Well, not everything. Context is showing variables, but checkpoints don't work and you can't control anything (like continue or step in/over etc).

Downgrade to xdebug-2.5.5 and php-7.1 works fine. I hope this will be resolved soon because you can't use xdebug-2.5.5 version with php>7.2

alexkuc commented 5 years ago

I found a quick and dirty fix (not sure how reliable though):

PHP version: 7.0.8 xDebug version: 2.4.0 Sublime Version: 3

"max_children": 999999,
"max_depth": 999999,
"max_data": 999999,
"super_globals": false,

SublimeTextXDebug was installed through Package Control

konoknir commented 5 years ago

Nope... because any associative array breaks it due to quotes... Besides, super globals are super important sometimes

misternode commented 5 years ago

@konoknir I have a similar issue:

no controls for stepping. I am able to get breakpoint working, though.

Please let me know if you found any resolution

php 7.3.1, xdebug 2.7.2

I had to modify protocol.py as per https://github.com/martomo/SublimeTextXdebug/issues/184

holt83 commented 5 years ago

@meengit Sorry for late response too.

In the console it shows the same error mentioned by @konoknir:

  File "C:\.....\Xdebug Client\xdebug\protocol.py", line 173, in read_data
    raise ProtocolException('Length mismatch encountered while reading the Xdebug message')
Xdebug Client.xdebug.protocol.ProtocolException: Length mismatch encountered while reading the Xdebug message

Also, I verified that I was in fact using your fork.

meengit commented 5 years ago

Hi @holt83

To be sure: Can you try with these https://github.com/martomo/SublimeTextXdebug/issues/194#issuecomment-476271415 settings? Especially super_globals: true. If I remember correctly, there was a deeper issue if you set super globals to false. If it does not work again, I will try to solve this for Windows on my fork. On MacOS I have no issues (with the mentioned settings).

godbout commented 5 years ago

Blank for me too with this package through package control or the fork from @meengit. xDebug connects but doesn't stop on breakpoints, and only shows the variable I watch. xDebug seems fine, as it's been quite straightforward to use with Code and PHPStorm.

konoknir commented 4 years ago

I can confirm that this fork works (php-7.3.10 + xdebug-2.7.2): https://github.com/ryanpcmcquen/SublimeTextXdebugPlus

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.