Snow Leopard 上的 var_dump() 输出不可读?

发布于 2024-08-18 06:29:00 字数 2580 浏览 6 评论 0原文

我已按如下所示配置了 xdebug,但错误输出完全不可读。 您知道设置有什么问题吗?

TIA 与最好的问候

设置:雪豹服务器上的 Apache/2.2.13 (Unix) PHP/5.3.0

来自 php.ini 的配置:

xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_host=10.0.1.9
xdebug.remote_connect_back=0
xdebug.idekey="macgdbp"
xdebug.remote_port=10000
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"

; profiler
xdebug.profiler_output_dir = "/tmp/xdebug/"
xdebug.profiler_enable = On

; stacktraces & var_dump() output config
xdebug.overload_var_dump=1
xdebug.show_local_vars=1
xdebug.collect_params=4
xdebug.dump.GET=*
xdebug.dump.POST=*
xdebug.dump_globals=On
xdebug.show_exception_trace=On

; codetracer
xdebug.auto_trace=On
xdebug.trace_output_dir="/Users/admin/Sites/xdebugtracer"
xdebug.collect_return=On

输出:

注意:未定义变量:/Users/admin/Sites/hanak4/scripts/jwplaylist.php 中的文件第 76 行调用堆栈:0.0003 648584 1. {main}() /Users/admin/Sites/hanak4/scripts/ jwplaylist.php:0 本地范围内的变量 (#1): $config = class stdClass { public $showFirst = 'youtube';公共 $playFirst = '01 Hanak Heumarkt.flv' } $db_host = 'localhost' $db_link = FALSE $db_name = 'db_fernan' $db_pass = 'Yes6uf5eNa' $db_prefix = 'ing_' $db_user = 'usr_fernan' $e = *未初始化* $fh = array (0 => '{"showFirst":"youtube","playFirst":"01 Hanak Heumarkt.flv"}') $file = FALSE $files = *未初始化* $key = *未初始化* $parts = array (0 => 'Hanak Jeckdance 2009', 1 => 'flv') $path = '.' $pointer = 类型(未知)的资源(7) $sql = 'SELECT * FROM ing_video ORDER BY id DESC' $videos = array (0 => '01 Hanak Heumarkt.flv', 1 => 'Center TV. flv', 2 => 'Express TV.flv', 3 => 'Hanak Jeckdance 2009.flv') $xmlstr = '\n\n\t '

警告:在第 76 行的 /Users/admin/Sites/hanak4/scripts/jwplaylist.php 中为 foreach() 提供的参数无效 调用堆栈:0.0003 648584 1. {main}() /Users/admin/Sites/hanak4 /scripts/jwplaylist.php:0 本地范围内的变量 (#1): $config = class stdClass { public $showFirst = 'youtube';公共 $playFirst = '01 Hanak Heumarkt.flv' } $db_host = 'localhost' $db_link = FALSE $db_name = 'db_fernan' $db_pass = 'Yes6uf5eNa' $db_prefix = 'ing_' $db_user = 'usr_fernan' $e = *未初始化* $fh = array (0 => '{"showFirst":"youtube","playFirst":"01 Hanak Heumarkt.flv"}') $file = FALSE $files = *未初始化* $key = *未初始化* $parts = array (0 => 'Hanak Jeckdance 2009', 1 => 'flv') $path = '.' $pointer = 类型(未知)的资源(7) $sql = 'SELECT * FROM ing_video ORDER BY id DESC' $videos = array (0 => '01 Hanak Heumarkt.flv', 1 => 'Center TV. flv', 2 => 'Express TV.flv', 3 => 'Hanak Jeckdance 2009.flv') $xmlstr = '\n\n\t '

I have xdebug configured as shown below but the error-output is totally unreadable.
Do you have an idea what's wrong with the setup?

TIA & best regards

Setup: Apache/2.2.13 (Unix) PHP/5.3.0 on Snow Leopard Server

Config from php.ini:

xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_host=10.0.1.9
xdebug.remote_connect_back=0
xdebug.idekey="macgdbp"
xdebug.remote_port=10000
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"

; profiler
xdebug.profiler_output_dir = "/tmp/xdebug/"
xdebug.profiler_enable = On

; stacktraces & var_dump() output config
xdebug.overload_var_dump=1
xdebug.show_local_vars=1
xdebug.collect_params=4
xdebug.dump.GET=*
xdebug.dump.POST=*
xdebug.dump_globals=On
xdebug.show_exception_trace=On

; codetracer
xdebug.auto_trace=On
xdebug.trace_output_dir="/Users/admin/Sites/xdebugtracer"
xdebug.collect_return=On

Output:

Notice: Undefined variable: files in /Users/admin/Sites/hanak4/scripts/jwplaylist.php on line 76 Call Stack: 0.0003 648584 1. {main}() /Users/admin/Sites/hanak4/scripts/jwplaylist.php:0 Variables in local scope (#1): $config = class stdClass { public $showFirst = 'youtube'; public $playFirst = '01 Hanak Heumarkt.flv' } $db_host = 'localhost' $db_link = FALSE $db_name = 'db_fernan' $db_pass = 'Yes6uf5eNa' $db_prefix = 'ing_' $db_user = 'usr_fernan' $e = *uninitialized* $fh = array (0 => '{"showFirst":"youtube","playFirst":"01 Hanak Heumarkt.flv"}') $file = FALSE $files = *uninitialized* $key = *uninitialized* $parts = array (0 => 'Hanak Jeckdance 2009', 1 => 'flv') $path = '.' $pointer = resource(7) of type (Unknown) $sql = 'SELECT * FROM ing_video ORDER BY id DESC' $videos = array (0 => '01 Hanak Heumarkt.flv', 1 => 'Center TV.flv', 2 => 'Express TV.flv', 3 => 'Hanak Jeckdance 2009.flv') $xmlstr = '\n\n\t '

Warning: Invalid argument supplied for foreach() in /Users/admin/Sites/hanak4/scripts/jwplaylist.php on line 76 Call Stack: 0.0003 648584 1. {main}() /Users/admin/Sites/hanak4/scripts/jwplaylist.php:0 Variables in local scope (#1): $config = class stdClass { public $showFirst = 'youtube'; public $playFirst = '01 Hanak Heumarkt.flv' } $db_host = 'localhost' $db_link = FALSE $db_name = 'db_fernan' $db_pass = 'Yes6uf5eNa' $db_prefix = 'ing_' $db_user = 'usr_fernan' $e = *uninitialized* $fh = array (0 => '{"showFirst":"youtube","playFirst":"01 Hanak Heumarkt.flv"}') $file = FALSE $files = *uninitialized* $key = *uninitialized* $parts = array (0 => 'Hanak Jeckdance 2009', 1 => 'flv') $path = '.' $pointer = resource(7) of type (Unknown) $sql = 'SELECT * FROM ing_video ORDER BY id DESC' $videos = array (0 => '01 Hanak Heumarkt.flv', 1 => 'Center TV.flv', 2 => 'Express TV.flv', 3 => 'Hanak Jeckdance 2009.flv') $xmlstr = '\n\n\t '

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

饭团 2024-08-25 06:29:00

你必须

html_errors = On

在 php.ini 中进行设置,这样 xdebug 才能正确输出。

You have to set

html_errors = On

in your php.ini, this allow xdebug to output correctly.

隔纱相望 2024-08-25 06:29:00

您是否在预标记之间打印此内容?


print '<pre>';
var_dump($my_var);
print '</pre>';

这应该确保格式正确。我不知道为什么没有颜色。

Are you printing this between pre tags?


print '<pre>';
var_dump($my_var);
print '</pre>';

That should ensure the formatting is correct. I'm not sure why there are no colors.

天涯沦落人 2024-08-25 06:29:00

看起来您的错误日志没有在每个错误之间读取(或添加)换行符(或者这就是它发布到 SO 的方式?)

注意:在向问题添加代码或输出时,请使用编辑器中的代码按钮 -就是那个看起来像 101010 的那个。

It looks like your error log is not reading (or adding) a newline character between each error (or is this just how it posted to SO?)

Note: when adding code or output to a question, use the code button in the editor - it's the one that looks like 101010.

墨小沫ゞ 2024-08-25 06:29:00

我已经找到了解决方案。从两个月前开始我就遇到了同样的“问题”。

尝试一下:

打开 MAMP ->转到文件菜单 ->编辑模板-> PHP (your-version).ini

在文件末尾取消注释 Xdebug 扩展。

您也可以设置 html_errors = On

我希望能帮助像我这样的其他人。

I have found the solution. I got the same "problem" since two months ago.

Try it:

Open MAMP -> go to File Menu -> Edit Template -> PHP (your-version).ini

In the end of file uncomment the Xdebug extension.

Also you can set html_errors = On

I hope help other like me.

血之狂魔 2024-08-25 06:29:00

如果您无法编辑 php.ini 并且您错过了添加 pre 标记,您还有另一种方法可以查看完整的错误,即在任何浏览器中查看源代码,我经常使用它来修复。

if you are not in a position to edit php.ini and also if you miss adding pre tags , you have a another way to see the complete error , by doing a view source in any browser , I often use that to fix .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文