Ignore PHP Strict Errors and Warnings

March 31st, 2014

Warning: This post is 10 years old. Some of this information may be out of date.

After upgrading to PHP 5.4 on one of our older code-bases I'm finding the error logs full of PHP Strict Errors and warnings. As this code is old and not financially viable to fix all these issues I needed to ignore the errors and warnings.

To ignore the strict errors and warnings you should set PHP's error_reporting to the following:

    ini_set('error_reporting', E_ALL & ~E_STRICT ^ E_NOTICE);

The code now shows all warnings and errors except Strict and Notices.

If anyone has any other tips or snippets to deal with this please leave a comment below.