[wp-testers] Strict standards Warnings all over the Place

Jacob Santos wordpress at santosj.name
Mon Feb 11 21:23:58 GMT 2008


<?php

if (defined('WP_DEBUG') and WP_DEBUG == true) {
    if( defined('E_STRICT') )
       error_reporting(E_ALL ^ E_STRICT);
    else
        error_reporting(E_ALL);
} else {
    if( defined('E_STRICT') )
        error_reporting(E_ALL ^ E_STRICT ^ E_NOTICE ^ E_USER_NOTICE);
    else
        error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
}

Would be better to just use a function, but for its purpose, I think 
repeating thyself would reduce optimization.

if( defined('E_STRICT') ) {
    $error_reporting = error_reporting(0);

    error_reporting($error_reporting ^ E_STRICT);
}

Just after the current error reporting code. Choose one that sucks less.


DD32 wrote:
> A simpler way (I'll trac it tomorrow if someone else doesnt) is to change wp-settings.php, 
> add " ^ E_STRICT" to the end of the error_reporting settings on lines ~160.
> I'm pretty sure if its running as PHP4, then it'll have no effect.. But it might be worth defineing E_STRICT just before if not allready defined.
>
> On Mon, 11 Feb 2008 21:28:27 +1100, Tom Klingenberg <tklingenberg at lastflood.net> wrote:
>
>   
>> Disabling is no problem for me, maybe as an improvement wordpress could
>> increase it's out of the box compability with php 5 hosts as well with
>> this little function added:
>>
>> /**
>>   * error_reporting_unstrict
>>   *
>>   * Disable Strict Errors if applicable because wordpress
>>   * is not php 5 strict compatible.
>>   */
>> function error_reporting_unstrict()
>> {
>> 	// check if E_STRICT does already exists
>> 	if ( defined($name = 'E_STRICT') === FALSE )
>> 	{
>> 		return;
>> 	}
>>
>> 	/*
>> 	 * Change Error-Reporting by only removing
>> 	 * the E_STRICT
>> 	 */
>>
>> 	// Read out current Error Reporting value
>> 	$orig = error_reporting(0);
>>
>> 	// If E_STRICT is set, unset it in the bitmask
>> 	if ( $orig & E_STRICT )
>> 	{
>> 		// Unsetting E_STRICT from bitmask
>> 		$changed = ($orig ^ E_STRICT);
>>
>> 		// Set the changed Bitmask
>> 		error_reporting($changed);
>> 	}	
>> }
>>
>> // Disable Strict Errors //
>> error_reporting_unstrict();
>>
>> right now I place it ontop of wp-config.php but I need to do it by hand
>> and after each configuration. I dunno if there is already a compat layer
>> in wordpress for higher version, I only saw one include file for lower
>> versions and missing php functions. so I suggest to have some kind of
>> auto-fixing this by default sothat a setup can run more smooth.
>>
>> -- Tom
>>
>> On Sun, 10 Feb 2008 15:59:37 +0100, Jacob Santos <wordpress at santosj.name>
>> wrote:
>>
>>     
>>> DD32 wrote:
>>>       
>>>> I believe Notices are going to slowly be fixed, However "Strict"
>>>> warnings are not a high priority, Infact, I'd suggest disabling them
>>>> entirely myself.
>>>>
>>>> On Sun, 10 Feb 2008 22:32:00 +1100, Tom Klingenberg
>>>> <tklingenberg at lastflood.net> wrote:
>>>>
>>>>
>>>>         
>>>>> I just grabbed the latest SVN version and it threw some strict standard
>>>>> warnings out of the box. Is there any Information how to deal with
>>>>> them?
>>>>> Do wordpress DEVs want to have fixes for those or is it just something
>>>>> to
>>>>> ignore right now?
>>>>>
>>>>> -- Tom
>>>>> _______________________________________________
>>>>> wp-testers mailing list
>>>>> wp-testers at lists.automattic.com
>>>>> http://lists.automattic.com/mailman/listinfo/wp-testers
>>>>>
>>>>>
>>>>>           
>>>>
>>>> _______________________________________________
>>>> wp-testers mailing list
>>>> wp-testers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-testers
>>>>
>>>>         
>>> Agreed. Strict warnings are PHP5 related and since WordPress isn't going
>>> PHP5, those warnings will not have any patches until  WordPress does
>>> fully support PHP5. I forget how I disabled them, but there is enough
>>> documentation out there. I will say that if it is throwing errors, then
>>> it will be worth suppling a patch to change the error reporting to
>>> ignore those warning.
>>>
>>>       
>> _______________________________________________
>> wp-testers mailing list
>> wp-testers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-testers
>>
>>     
>
>
>
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>   


-- 

Jacob Santos

http://www.santosj.name - blog
http://funcdoc.wordpress.com - WordPress Documentation Blog/Guide Licensed under GPLv2

Also known as darkdragon and santosj on WP trac.



More information about the wp-testers mailing list