Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling Strict Standards Errors in WordPress 3.7 with PHP 5.4

I am trying to disable STRICT Error reporting in WordPress 3.7 via my php.ini file after updating my computer to OS X 10.9. I am running PHP Version 5.4.17, the one that ships with Mavericks.

In my wp-config.php file, I have enabled define('WP_DEBUG', true); which was on a working fine before upgrading my OS and as a result, PHP.

In the php.ini file, I have tried setting error_reporting to:

error_reporting = E_ALL

or

error_reporting = E_ALL & ~E_STRICT

or

error_reporting = E_ALL & ~E_DEPRECATED

even

error_reporting = 0

But the errors still appear.

display_errors is set to Off:

display_errors = Off

After each change to the file, I am restarting apache and httpd with these two commands:

httpd -k restart
apachectl restart

The php.ini file I am editing is the same one being pointed to in phpinfo() AND just to make sure changes are going through, I have been editing the error_prepend_string value:

error_prepend_string = "<span style='color: #ff0000'>ERROR: "

and those changes are coming through in the error.

Any thoughts on how to debug this would be much appreciated.

like image 253
jeremyzilar Avatar asked Oct 25 '13 01:10

jeremyzilar


1 Answers

In Wordpress 3.7, the function wp_debug_mode (defined in wp-includes/load.php, and called from wp-setings.php) sets error_reporting( E_ALL ).

Since wp-settings.php is itself loaded at the end of wp-config.php, you cannot change this setting from wp-config.php (or rather, you can, but it will be overridden).

A solution is to create a "Must Use plugin", that is to say a .php file located in the /wp-content/mu-plugins/ folder containing :

<?php
if (WP_DEBUG && WP_DEBUG_DISPLAY) 
{
   ini_set('error_reporting', E_ALL & ~E_STRICT & ~E_DEPRECATED);
}
like image 127
adelval Avatar answered Nov 01 '22 23:11

adelval