[development] Question about error_reporting()

Larry Garfield larry at garfieldtech.com
Fri Aug 8 14:51:20 UTC 2008

The ^ is the bitwise NOT operator in PHP.  PHP defines a bunch of bitmasks to flag different error levels.  E_ALL is the bit mask for "everything except STRICT-level", so that line means "everything except STRICT level but not NOTICE level".

If your watchdog table is filling up with PHP warning messages, then you have a serious bug in your code somewhere.  Do not hide the error.  Fix the bug. :-)  Look at the error message itself to see what the problem is, track it down, and squish it.

--Larry Garfield

On Fri, 8 Aug 2008 15:10:50 +0200, "Juan Rodriguez" <juan.fco.rodriguez at gmail.com> wrote:
> Hi guys,
> I am looking at the implementation of error_reporting:
> http://api.drupal.org/api/function/error_handler/5
> and I don't understand this line:
>   if ($errno & (E_ALL ^ E_NOTICE)) {
> does it means that all errors but E_NOTICE are gonna be reported ?
> (what I really dont get is the meaning of the ^ php operator....)....
> I am trying to understand this code because my watchdog table is
> getting full of PHP warning
> messages, and I was not able to found a configuration option to filter
> this kind of messages.
> Would it be possible to change the behaviour to report messages above
> or below a specific level like
> it is done in php.ini ?
> Thanks in advance.

More information about the development mailing list