CakePHP command line doesn't work when xdebug loaded

六月ゝ 毕业季﹏ 提交于 2019-12-01 20:25:59

问题


I'm trying to use xdebug against PHP 7.1.6 to troubleshoot a failing unit test in my CakePHP v3.3.6 project. I've set up xdebug using the following settings:

[xdebug]
xdebug.remote_enable = on
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
xdebug.remote_autostart = 1
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug.show_local_vars=0
xdebug.max_nesting_level=256

PHP now connects to my xdebug client (VisualStudio Code) but as soon as I run phpunit ./vendor/phpunit/phpunit/phpunit or the Cake console ./bin/cake.php there's immediately an exception:

type: Aura\Intl\Exception

message: "Package 'cake' with locale 'en_US' is not registered."

I had a look online and I found one other person encountering the same issue but their eventual solution was just to disable xdebug, which isn't what I want. I'm wondering how having xdebug enabled can cause this issue, and how I can work around it.

Thanks!

EDIT: Worth noting I tried disabling caching by putting the following in my bootstrap.php

// Disable all cache reads, and cache writes.
Cache::disable();

This didn't help.


回答1:


I had this error too. I found that it somehow was related to VS Code, since I had no problems debugging in Sublime.

After a bit of trial and error I found that adding:

"ignore": [
    "**/vendor/**/*.php"
]

to my launch.json fixed the problem. I'm not quite sure about this magic behind, but now I am able to move on.

https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug



来源:https://stackoverflow.com/questions/44895450/cakephp-command-line-doesnt-work-when-xdebug-loaded

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