(solved) Xdebug 3, PHP 8.0.11, xdebug fails at variable?
I recently tried to switch from PHP 7 to PHP 8, but I'm having trouble with xdebug behaving oddly.
Basically step-sequencer seems to hit just fine. "Variables"-view does show $_COOKIE and $_SERVER -variables, but whenever I assign an variable, such as "$i = 0;" step debug seems to somehow fail or disconnect. After few seconds browser tries to reload script and step sequencer is hit again.
Some steps seem to work. For example:
<?php
echo "is it working?";
die();
$i = 0;
$x = 123; // Debugger never reaches here, no matter what
... results to "is it working?" -output, but if I move the "die()" to come after setting $i, script seems to somehow fail and restart. Browser displays "This site can't be reached".
I haven't been able to produce any errors to any logs or such. Any idea what could be causing this? No such issues on PHP 7 and older version of xdebug.
EDIT: Here is an animation of this problem.
Please sign in to leave a comment.
What are your xdebug settings in php.ini file?
Do you have XDebug logging enabled? Enable it if not & share the log. If the log isn't generated - then either the log file location is incorrect or XDebug session doesn't get initiated. We can check both once you share the xdebug section of your php.ini file.
Btw, is it a local or remote debugging?
Both php.ini and xdebug log can be seen here:
https://controlc.com/b215b1f1
It's local debugging. Whenever xdebug is disabled everything works fine, so it's dying / disconnecting when hitting variables. I first noticed this odd behavior on Laravel-project when project didn't load. I noticed that Index did hit, but when it continued to class autoloading ("require" -row) it died silently and browser tried to reload page, resulting to this retry-loop. After this I made this small snippet for trying to understand whether debugger is really working or not, and noticed that $variables killed step debugger.
Edit: I'm unsure of the concept and difference between local- and remote-debugging on this case. Both IDE and XAMPP run on same machine, so I would assume we are talking about local debugging.
For ref purposes: the same on Stack Overflow: https://stackoverflow.com/questions/69449103/phpstorm-xdebug-3-php-8-0-11-xdebug-fails-at-variable
Please try debugging in CLI environment first: does it work there (using the same PHP interpreter from XAMPP)? Could be OPCache related (try disabling it if it's enabled). BTW -- if it's enabled -- where is it declared -- before or after Xdebug?
Is this a full XDebug log? It ends at [9756] [Step Debug] <- step_over -i 32 but it shouldn't.
Would it help if you try another XDebug version, e.g. Xdebug 3.0.4?
Thanks for feedback. I double checked that I was using Thread Safe version (yes, I was using), which corresponds the fact that DLL was loaded on steps were working to a point. Tried using NTS version as well, but that didn't load up (douh).
Problem seems to be either on PhpStorm or Xdebug-3.1.0 Thread Safe version, because switching to Xdebug-3.0.4 started working without problems! Hopefully this gets fixed soon.
You might want to report this to XDebug tracker: https://xdebug.org/reporting-bugs
Will do. Already reported to JetBrains, as it's unclear whether this is error at PhpStorms listener or Xdebugs communicator
Do you have a link to a JetBrains report? Asking to avoid confusion, since this is a JetBrains forums.
Oh sorry, didn't notice your JB avatar and thus didn't know who I was chatting with.
https://intellij-support.jetbrains.com/hc/en-us/requests/3546269