Disable Deprecated Warning in Symfony 2(.7)

Disable deprecated warning in Symfony 2(.7)

I have the same problem and solved it similar to the below link. Symfony declares to report all errors and overrides what you put in php.ini by design (otherwise it couldn't catch & display nice stack traces for you).

So, you'll need to override Symfony2's built-in error reporting by creating an init() function in your AppKernel.php and setting the error_reporting how you'd like there, along with (probably) some environment detection to make sure you don't display errors in production, for example:

// Add this to app/AppKernel.php
public function init()
{
if ($this->debug) {
ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
} else {
ini_set('display_errors', 0);
}
}

More details here (use Google Translate if you do not read Russian :) http://tokarchuk.ru/2012/12/disable-deprecated-warnings-in-symfony-2/

Suppress deprecation warnings in Symfony 3

Had to postpone the problem for a few days, then I noticed my mistake: The suggestion from this answer works if you don't mess up the Monolog config: https://stackoverflow.com/a/35779541/10249309

Remove Remaining deprecation notices in Symfony 2.8

Finally found the solution !

Just add

<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
</php>

to your phpunit.xml (or any other file that you use to configure phpunit)

Turn off deprecated and strict errors when running tests

Working solution for me: Install this component:

composer require symfony/debug

And add this in AppKernel#init:

if ($this->debug ) {
Debug::enable(E_RECOVERABLE_ERROR & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED, false);
// ...

Symfony 4.4 deprecation warning for multiple clients in user test is deprecated, still present in documentation

You need to shutdown the kernel.
WebTestCase extends KernelTestCase, which provides a static method self::ensureKernelShutdown().

Call this before creating the clients.

This is indeed still missing from the documentation.



Related Topics



Leave a reply



Submit