dlitsman
dlitsman

Reputation: 271

Xdebug does not work with var_dump()

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().

Upvotes: 9

Views: 6016

Answers (5)

tertek
tertek

Reputation: 1002

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.

Upvotes: 16

Jonathan Clark
Jonathan Clark

Reputation: 1260

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.

Upvotes: 7

cdevries
cdevries

Reputation: 69

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

;xdebug.mode=debug

and restart Apache.

Upvotes: 0

Thomas Anderson
Thomas Anderson

Reputation: 521

For php 7.0.2 and xdebug 2.4.0

xdebug.default_enable=1

+

html_errors = On

Still does not colorize xdebug_var_dump() output.

but this patch fixes my issue. It applies to the xdebug.c and xdebug_var_dump() only. I think they made a mistake that xdebug_var_dump works only if it need to be overload function.

@@ -2191,11 +2191,6 @@
    int     i, len;
    char   *val;

-   if (!XG(overload_var_dump)) {
-       XG(orig_var_dump_func)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
-       return;
-   }
-
    argc = ZEND_NUM_ARGS();

 #if PHP_VERSION_ID >= 70000

Upvotes: 1

happy_marmoset
happy_marmoset

Reputation: 2215

I found that option "xdebug.default_enable Off Off" in you php_info(). I also have noticed that in last versions of EasyPHP this option is turned off. So turn it on by setting this line in php.ini:

xdebug.default_enable=1

Next is just common operation which disables var_dump and other errors in HTML output completely (not your case, but maybe helpful for others):

html_errors = On

Upvotes: 21

Related Questions