Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off deprecated errors in PHP 5.3

My server is running PHP 5.3 and my WordPress install is spitting these errors out on me, causing my session_start() to break.

Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 647  Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 662  Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 669  Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 676  Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 712 

This is annoying, but I do not want to turn off on screen error reporting. How do I disable these bothersome deprecated warnings?

I am running WordPress 2.9.2.

like image 850
atwellpub Avatar asked May 10 '10 15:05

atwellpub


People also ask

How do I turn off PHP errors?

To turn off or disable error reporting in PHP, set the value to zero. For example, use the code snippet: <? php error_reporting(0); ?>

How do I turn off deprecated warnings in WordPress?

As an interim solution, it is simple to suppress PHP deprecation warnings by disabling WP_DEBUG mode, or (more advanced) by removing E_DEPRECATED from your error_reporting setting.


2 Answers

You can do it in code by calling the following functions.

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); 

or

error_reporting(E_ALL ^ E_DEPRECATED); 
like image 96
Robus Avatar answered Oct 06 '22 00:10

Robus


To only get those errors that cause the application to stop working, use:

error_reporting(E_ALL ^ (E_NOTICE | E_WARNING | E_DEPRECATED)); 

This will stop showing notices, warnings, and deprecated errors.

like image 42
codefreak Avatar answered Oct 05 '22 23:10

codefreak