‘Deprecated’ error warnings – PHP 5.3
Just reviewing some sites in my portfolio, and I notice that a CubeCart installation on a shared host is broken. Oh dear…
Deprecated: Function set_magic_quotes_runtime() is deprecated in /path/to/domain/shop/ini.inc.php on line 114Warning: ini_set(): Cannot change zlib.output_compression - headers already sent in /path/to/domain/shop/ini.inc.php on line 118 Warning: Cannot modify header information - headers already sent by (output started at /path/to/domain/shop/ini.inc.php:114) in /path/to/domain/shop/index_enc_ion.php on line 31 Warning: Cannot modify header information - headers already sent by (output started at /path/to/domain/shop/ini.inc.php:114) in /path/to/domain/shop/index_enc_ion.php on line 32Deprecated: Function eregi() is deprecated in /path/to/domain/shop/includes/functions.inc.php on line 408
Ah, great. Without warning, we’ve been upgraded to PHP 5.3
Thanks for that…
Anyway, it’s easily solved.
With 5.3 a new error level has been introduced – E_DEPRECATED, so it’s easy to suppress deprecated errors:
In your scripts:error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
In the case of CubeCart 4 this can be acheived in ini.inc.php line 101.
In php.ini:
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
in .htaccess:
php_value error_reporting 1
.htaccess requires the correct integer value equivalent of your chosen reporting level – these are a touch obscure, but setting it to 1 means report fatal run-time errors and unrecoverable errors, which will do the trick.