简体   繁体   English

如何删除弃用的 Symfony\Component\Debug\DebugClassLoader?

[英]How to remove Deprecated Symfony\Component\Debug\DebugClassLoader?

I have upgrade Symfony 3.4 to 4.4.我已经将 Symfony 3.4 升级到 4.4。 The only Deprecation warning left is this:剩下的唯一弃用警告是:

php.INFO: User Deprecated: The "Symfony\Component\Debug\DebugClassLoader" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\DebugClassLoader" instead. php.INFO:用户已弃用:自 Symfony 4.4 以来,“Symfony\Component\Debug\DebugClassLoader”class 已弃用,请改用“Symfony\Component\ErrorHandler\DebugClassLoader”。 {"exception":"[object] (ErrorException(code: 0): User Deprecated: The "Symfony\Component\Debug\DebugClassLoader" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\DebugClassLoader" instead. at /vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:16)"} [] {"exception":"[object] (ErrorException(code: 0): User Deprecated: The "Symfony\Component\Debug\DebugClassLoader" class 自 Symfony 4.4 以来已弃用,请改用 "Symfony\Component\ErrorHandler\DebugClassLoader"。在/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:16)"} []

I am not use DebugClassLoader anywhere.我没有在任何地方使用DebugClassLoader How do I remove this warning?如何删除此警告?

Check your index.php and your bin/console files.检查您的index.phpbin/console文件。

In index.php , for example, there should be a part like this:例如,在index.php ,应该有这样的部分:

if ($_SERVER['APP_DEBUG']) {
    umask(0000);

    Debug::enable();
}

But the corresponding import is likely to be:但是对应的导入很可能是:

use Symfony\Component\Debug\Debug;

In both files change it to:在这两个文件中将其更改为:

use Symfony\Component\ErrorHandler\Debug;

Check your bin/console file.检查您的bin/console文件。

You need change:你需要改变:

use Symfony\\Component\\Debug\\Debug;使用 Symfony\\Component\\Debug\\Debug;

to:到:

use Symfony\\Component\\ErrorHandler\\Debug;使用 Symfony\\Component\\ErrorHandler\\Debug;

When command is executed you will receive a deprecation message.执行命令时,您将收到一条弃用消息。

in Configuration.php (vendor/codeception/codeception/src/Codeception)在 Configuration.php(供应商/codeception/codeception/src/Codeception)

set

'convert_deprecations_to_exceptions' => true

That worked good for me这对我很有用

If you check the trace, you will see:如果检查跟踪,您将看到:

User Deprecated: The "Symfony\Component\Debug\DebugClassLoader" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\DebugClassLoader" instead.
Show context    Hide trace
{▼
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:16 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php:216 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php:149 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php:341 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/VarDumper/Cloner/VarCloner.php:209 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php:274 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php:85 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php:75 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/Profiler.php:100 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php:127 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php:126 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:264 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:239 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:73 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:168 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:103 {▶}
  /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:166 {▶}
  /var/www/html/web/app_dev.php:13 {▼
    › $response->send();
    › $kernel->terminate($request, $response);
    › 
  }
}

It seems to be coming from Symfony/Component/HttpKernel/Kernel .它似乎来自Symfony/Component/HttpKernel/Kernel

Search the usage in vendor folder, if it comes from other component than Symfony, check maybe newer version of the component, has a fix for it.在 vendor 文件夹中搜索用法,如果它来自 Symfony 以外的其他组件,请检查组件的更新版本,是否有修复程序。 If the deprecated component is used by only Symfony itself, I would not spend too much time worrying about it.如果弃用的组件仅由 Symfony 本身使用,我不会花太多时间担心它。 It will get resolved, once you upgrade your Symfony to the next major version.一旦您将 Symfony 升级到下一个主要版本,它就会得到解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM