I have installed the Drupal 6.x-dev version and I have some notices.

I know that the stable versions have the E_NOTICE disable and the development versions have E_NOTICE disable... but, What I have to do to use the development version and disable de PHP E_NOTICES?

Comments

oriol_e9g’s picture

Sorry... :D

replace:

the development versions have E_NOTICE disable...

by this

the development versions have E_NOTICE enable...
danchadwick’s picture

(oops).

danchadwick’s picture

I know this is an old post, but I have the same problem. I need to run the latest -dev of core, but need to turn off E_NOTICE error_reporting. I can't seem to find where the development version turns it on. It is set to E_ALL in php.ini, but when running a production version (e.g. 6.17), I don't get any E_NOTICES.

Where is the best way to turn E_NOTICE error_reporting on and off in 6.x-dev? I've searched and searched the code and d.o for an answer. Many thanks.

WorldFallz’s picture

Try adding ini_set('error_reporting', !E_NOTICE & !E_WARNING); to your settings.php file.

danchadwick’s picture

Thanks for your reply.

I think that because I'm running 6.x-dev, the E_NOTICE's are being turned on again somewhere.

I tried:
php.ini (error_reporting = E_ALL & ~E_NOTICE)

I also tried setting it in .htaccess and in settings.php with the appropriate commands.

settings.php reduced them, but I'm guessing that it's getting set back after some initialization code is run, or these notices are happening before settings.php runs.

I guess the crux of the question is "How does the -dev version set itself to display notices?" I've search for "error_reporting" and don't see it (much to my surprise) anywhere.

heine’s picture

Find drupal_error_handler() in common.inc and replace

 if ($errno & (E_ALL ^ E_DEPRECATED)) {

with

   if ($errno & (E_ALL ^ E_DEPRECATED ^ E_NOTICE)) {

edit: fixed order

danchadwick’s picture

Thank you, very, very much. And I did confirm that the difference between the released and dev version is this change.

It sure would be helpful if this were done in some different way so that one could easily have a development version showing the notices without having to worry about inadvertently deploying.

WorldFallz’s picture

Not sure what the problem is-- i use the dev version of core all the time and ini_set in settings.php always works. Try ini_set('error_reporting', 0) and see if all errors go away.

danchadwick’s picture

First, I was tricked because it takes two browser refreshes to really test this, because the first refresh may display queued messages.

Setting error_reporting to 0 in settings.php does, in fact work. But setting it to E_ALL ^ E_NOTICE (or equivalently E_ALL & ~E_NOTICE) doesn't. Very strange. Setting it to E_NOTICE (to, presumably show only notices) shows the same notices. I confirmed with the debugger than the constants are typed correctly (everything except E_STRICT and E_NOTICE).

I can only infer the core is doing something special with a value of 0. Setting it to 0 is a bit extreme, however, as errors won't be posted to the log in a production environment.

So this again leaves me with tweaking core for production versus dev use. I'm not sure if this is addressed in D7, but it seems like a good option to include in the error reporting admin.

jaxx0rr’s picture

in \sites\default\settings.php
add last line:
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);

Paul_israel’s picture

Thank you