Ignore PHP Strict Errors and Warnings

Image for Ignore PHP Strict Errors and Warnings from unsplash.com

By Andrew McCombe
March 31, 2014


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.