Search code examples
phperror-reporting

Getting deprecated error even after disabling them


I've set this in my php script:

error_reporting(E_ALL ^ E_DEPRECATED);

And yet when I run the code I get this:

Deprecated: Function split() is deprecated in /home/www/prog/classes/inc.general.php on line 669

Why is this? The PHP site mentions that this should work:

// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);

Solution

  • error_reporting(E_ALL & ~E_DEPRECATED);
    

    In development you should leave E_DEPRECATED enabled and fix your code instead. In production you should disable E_NOTICE too.

    Also make sure there is nothing within your application, that may change your settings later during the execution.