Xdebug does not work with var_dump()

Viewed 4867

I'm not sure why, but xdebug does not highlight var_dump(). But config seems to be fine. Have no idea why... Any suggestions?

This is my phpinfo(); http://pastebin.com/A45dqnWN

plus even xdebug_var_dump() doesn't highlight anything. It works, but look like normal var_dump().

5 Answers

For Xdebug 3 you need to enable develop mode in your php.ini:

xdebug.mode= develop

You can also use multiple modes at once as explained here.

The following values are accepted (for xdebug.mode):

  • off

    Nothing is enabled. Xdebug does no work besides checking whether functionality is enabled. Use this setting if you want close to 0 overhead.

  • develop

    Enables Development Helpers including the overloaded var_dump().

  • coverage

    Enables Code Coverage Analysis to generate code coverage reports, mainly in combination with PHPUnit.

  • debug

    Enables Step Debugging. This can be used to step through your code while it is running, and analyse values of variables.

  • gcstats

    Enables Garbage Collection Statistics to collect statistics about PHP's Garbage Collection Mechanism.

  • profile

    Enables Profiling, with which you can analyse performance bottlenecks with tools like KCacheGrind.

  • trace

    Enables the Function Trace feature, which allows you record every function call, including arguments, variable assignment, and return value that is made during a request to a file.

You can enable multiple modes at the same time by comma separating their identifiers as value to xdebug.mode: xdebug.mode=develop,trace.

As mentioned by @Shadoweb for Xdebug v3 you want debug to allow stopping at breakpoints, and develop to format the var_dump

The following you'll likely want in php.ini therefore:

xdebug.mode=develop,debug

As an aside, I also needed xdebug.start_with_request=yes to replace the renamed xdebug.xdebug.remote_enable=1 setting to get step debugging working in my IDE.

Turn off xdebug.mode=debug in php.ini like

;xdebug.mode=debug

and restart Apache.

Related