I’m running Windows 10, with a WSL2 Ubuntu instance. I do my development within the WSL2 instance with the “Remote – WSL” extension of Visual Studio Code. So my VSC is running as a WSL2 application, not as a Windows application. I have an additional remote server (I’ll refer to this as “Server X” which actually hosts/runs the PHP code.
Tag: xdebug
Xdebug + VSCode + PHP + WampServer : breakpoint not hit on start of debug session
A while back I succeeded at resolving this problem: How to properly setup VSCode and Wampserver to be able to debug and pause on breakpoint line, using VSCode / PHP XDebug / PHP Debug Extension? Now I have PHP 8 with the latest VSCode and Xdebug 3, but my breakpoint is not hit in my API, which runs with a
PHP var_dump() in xdebug ignores __debugInfo() magical method
Xdebug seems to ignore PHP magic method __debugInfo() in user defined classes when using var_dump(). This is especially unhandy when injecting dependencies (with dependencies, with dependencies…). Is there a setting for Xdebug’s var_dump() so it works with __debugInfo() as expected? Or a workaround in PHP maybe? I could not find anything. Answer Xdebug’s philosophy is to show data as it
Xdebug 3 not included in phpinfo()
I have a problem with Xdebug on Mac OS using Big Sur. Below, I will explain what is happening. When I run phpinfo() – I don’t see a Xdebug section at all. When I run commands such as xdebug_call_file() it throws a PHP Fatal error: Uncaught Error: Call to undefined function error. Here are all the configurations: php -v: PhpStorm
Xdebug always listening for new requests and prevents webpages from loading in case I don’t listen
I have a strange setup on my new workplace and it works like this: if I have PhpStorm running and have “Start Listening for PHP Debug Connections” on, then my local PHP application works fine. As soon as I close PhpStorm completely (and consequently stop listening to PHP debug connections), then my webpage is not loading (nginx times out after
Cannot step xdebug with NetBeans since php 8
Since upgrading from php 7 to php 8, I can no longer Step Into/Step Over/Continue with NetBeans IDE 11.0 and xdebug 3.0.4. xdebug (via NetBeans) is configured to “Stop at First Line” – and this works. That is, the (local host) web page is suspended, and the NetBeans Step Into/Step Over/Continue buttons are enabled. But, when I click any of
Xdebug 3 doesn’t stop on breakpoints
I setted Xdebug extension and it’s installed, I can see it on phpinfo() but it doesn’t stop on the breakpoints and it doesn’t write anything into xdebug.log file. This is php.ini contents: And this is launch.json from VSCode: Answer You don’t say which of your three configurations you’re using, but if you’re using first the “Listen for Xdebug” one, then
Limit value of array show in debug side bar
I’m trying to increase the value limit of an array in debug side bar. By default, with an array with many elements, vscode only displays up to 32 values. I want to increase it to a certain number or unlimited. This is my launch.json file: But it seems that using max_data is incorrect. So, how to increase it to a
PHPUnit can’t generate code coverage when running tests in separate processes
I have a problem that I could not find the solution on Google. When I run my unit tests with PHPUnit and Xdebug, I would like to do a code coverage. However, when I do that, I get this error: I realized that this is because in some of my tests there is this at the top: When I remove
How to fully cover conditionals while testing code (eg. PHP and xdebug)
Some time ago I have started writing tests in PHPUnit (v. 9). It’s great and amazing but: How I can properly cover conditionals? I will give some examples where result is correct and expected, and where I see problems. Here it is: Please note that code below is only the sample. I know that when I pass true to if