Skip to content
Advertisement

PHP + Xdebug + VS Code: Bug on Debian 10?

When debugging in VS Code on Debian 10, local variables in a subroutine does not show in VC “Locals” when hitting a breakpoint. Sample code:

function testbug($param1)
{
  $grappa="grappa 2";
  echo "Test: ".$grappa.$param1."</br>";
}

The $grappa variable does not show in a debug session “Locals” variables on Debian, but is present on Ubuntu.

Debian:

Apache Version: Apache/2.4.38 (Debian)
Current PHP version: 7.3.14-1~deb10u1
Xdebug v2.7.0RC2

When running on a Ubuntu server, all is fine.

Ubuntu:

Apache Version: Apache/2.4.41 (Ubuntu)
Current PHP version: 7.3.15-1+ubuntu18.04.1+deb.sury.org+1
Xdebug v2.9.2

Can anyone advise? I’m stuck…

Advertisement

Answer

You’re running an old Xdebug with Debian, a Release Candidate (2.7.0RC2) even. Upgrade Xdebug to the latest supported version (https://xdebug.org/docs/compat).

Install the php-dev and php-pear packages with apt, and then run: pecl install xdebug. (Full installation docs at https://xdebug.org/docs/install).

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement