【问题标题】:CakePHP command line doesn't work when xdebug loaded加载 xdebug 时,CakePHP 命令行不起作用
【发布时间】:2017-12-07 07:20:03
【问题描述】:

我正在尝试针对 PHP 7.1.6 使用 xdebug 来解决我的 CakePHP v3.3.6 项目中失败的单元测试。我使用以下设置设置了 xdebug:

[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 现在连接到我的 xdebug 客户端(VisualStudio 代码),但只要我运行 phpunit ./vendor/phpunit/phpunit/phpunit 或 Cake 控制台 ./bin/cake.php,就会立即出现异常:

类型: Aura\Intl\Exception

消息:“区域设置为 'en_US' 的包 'cake' 未注册。”

我在网上查了一下,找到了one other person encountering the same issue,但他们最终的解决方案只是禁用 xdebug,这不是我想要的。我想知道启用 xdebug 会如何导致此问题,以及如何解决它。

谢谢!

编辑:值得注意的是,我尝试通过将以下内容放入我的 bootstrap.php 来禁用缓存

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

这没有帮助。

【问题讨论】:

    标签: php cakephp cakephp-3.0 xdebug intl


    【解决方案1】:

    我也有这个错误。我发现它在某种程度上与 VS Code 有关,因为我在 Sublime 中调试没有问题。

    经过一番反复试验,我发现添加:

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

    我的launch.json 解决了这个问题。我不太确定这背后的魔力,但现在我可以继续前进了。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-23
      • 2013-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-16
      • 1970-01-01
      相关资源
      最近更新 更多