Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove Deprecated Symfony\Component\Debug\DebugClassLoader?

Tags:

php

symfony

I have upgrade Symfony 3.4 to 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. {"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)"} []

I am not use DebugClassLoader anywhere. How do I remove this warning?

like image 670
Jake He Avatar asked Oct 19 '20 04:10

Jake He


People also ask

Is this component deprecated in Symfony?

This component is deprecated . Don't use it in any of your applications. Provides tools to ease debugging PHP code. This component is deprecated since Symfony 4.4, use the ErrorHandler component instead. API Platform is an Open Source web framework for API-first projects.

How do I enable debugclassloader in Symfony?

To activate the DebugClassLoader, call its static enable () method: use Symfony\Component\Debug\DebugClassLoader; DebugClassLoader::enable (); This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.

How to use exception handling in debug mode in Symfony?

It is useful in debug mode to replace the default PHP/XDebug output with something prettier and more useful: use Symfony\Component\Debug\ExceptionHandler; ExceptionHandler::register (); If the HttpFoundation component is available, the handler uses a Symfony Response object; if not, it falls back to a regular PHP response.

Can I use the API platform component in Symfony?

Don't use it in any of your applications. Provides tools to ease debugging PHP code. This component is deprecated since Symfony 4.4, use the ErrorHandler component instead. API Platform is an Open Source web framework for API-first projects.


Video Answer


2 Answers

Check your index.php and your bin/console files.

In index.php, for example, there should be a part like this:

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;
like image 70
yivi Avatar answered Oct 18 '22 23:10

yivi


Check your bin/console file.

You need change:

use Symfony\Component\Debug\Debug;

to:

use Symfony\Component\ErrorHandler\Debug;

When command is executed you will receive a deprecation message.

like image 24
Maksym Maksymenko Avatar answered Oct 19 '22 00:10

Maksym Maksymenko