Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP deprecated warnings on Drupal pages despite turning them off in php.ini

I have PHP deprecated errors flooding log files and Drupal status pages like this:

: Function ereg() is deprecated in mysite/includes/file.inc on line 893.

I should be able to turn off E_DEPRECATED errors in my php.ini, but it is having no effect despite being set to:

error_reporting = E_ALL & ~E_DEPRECATED

phpInfo() reports error_reporting master value and local value both 22527.

I did a

grep -R error_reporting 

in my document root in the hopes of finding any hard coded error levels and no luck:

./includes/common.inc:  // If the @ error suppression operator was used, error_reporting will have
./includes/common.inc:  if (error_reporting() == 0) {
./modules/system/system.module:    'page arguments' => array('system_error_reporting_settings'),
./modules/system/system.admin.inc:function system_error_reporting_settings() {
./modules/system/system.install:      $err = error_reporting(0);
./modules/system/system.install:      error_reporting($err);

Nothing that I can see that is supect except possibly the first line in system.install but if I'm right that should turn all errors OFF.

I'm not setting error_reporting in .htaccess, but doing that does not have any effect either.

I'm hoping that there is a solution that doesn't involve hard coding error levels in common.inc (which DOES work, I've tried - but obviously undesirable).

I know the deprecated errors are a result of upgrading to PHP 5.3, but downgrading PHP is not option (new sites are going live now on the same server that have been tested on 5.3, and the sites where these errors occur have 2 months to live). I also cannot upgrade to Drupal versions that play nicely with 5.3 as unfortunately the previous owner haxxed the core modules without documenting his changes.

Version stuff:

PHP 5.3.2-1, Ubuntu 10.04, Drupal 6.13 on one site, 6.5 (!!1!) on the other, Apache 2.2

like image 994
iftheshoefritz Avatar asked Nov 05 '10 08:11

iftheshoefritz


2 Answers

Did you try editing index.php to be


error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);

require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
like image 134
mpdonadio Avatar answered Nov 07 '22 11:11

mpdonadio


I have used this on my php.ini file and could hide those deprecated errors. Hope it helps you! =)

error_reporting  =  E_ALL & ~E_DEPRECATED & -E_WARNING
like image 2
Otto Avatar answered Nov 07 '22 11:11

Otto