Xdebug does not work with var_dump()

社会主义新天地 提交于 2021-01-27 04:41:07

问题


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


回答1:


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



回答2:


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.




回答3:


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



回答4:


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

;xdebug.mode=debug

and restart Apache.



来源:https://stackoverflow.com/questions/11882037/xdebug-does-not-work-with-var-dump

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!