Forum Moderators: coopster

Message Too Old, No Replies

PHP6 error reporting

Configuration directive changes in PHP 6

         

coopster

8:09 pm on Mar 30, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



In my development configurations I have error_reporting [php.net] set to
E_ALL
, including
E_STRICT
. Up to this point it has always been in PHP >= 5 you have to be specific to get
E_STRICT
messages by adding it to the
E_ALL
messages already active:
error_reporting = E_ALL ¦ E_STRICT

Don't forget, the forum breaks the pipe symbol so you need to rekey that if you copy/paste. Also note, using the constant syntax is valid only in PHP, such as in the php.ini. You cannot use the constant syntax in the Apache configuration, such as httpd.conf. You have to use the integer bitmask instead.

So? Where is this going? Well, PHP6 has updated the bitmask representation of the error_reporting constants.

E_STRICT
became part of [php.net]
E_ALL
now.
E_ALL
used to be 2047, and now it is 6143 and
E_STRICT
has taken over the old "next available" bit field of 2048.

This is all fine, and works well in your test environment if you just set the integer to the highest integer like the manual recommends:


Note: PHP Constants outside of PHP Using PHP Constants outside of PHP, like in httpd.conf, will have no useful meaning so in such cases the integer [php.net] values are required. And since error levels will be added over time, the maximum value (for
E_ALL
) will likely change. So in place of
E_ALL
consider using a larger value to cover all bit fields from now and well into the future, a numeric value like 2147483647.

But if you are testing software (Wordpress for instance) that has

E_STRICT
errors in it, it helps to turn the reporting down under
E_STRICT
so you don't have to look at all the errors. Just put an entry in your Apache configuration (httpd.conf or .htaccess) with the following value and you are good to go.
php_value error_reporting 2047

eelixduppy

6:22 pm on Apr 10, 2008 (gmt 0)



Thanks for that, coop. :)