[wp-testers] Widgets Pass By Reference Errors (was: Bleeding-edge errors on my blog)

Tom Klingenberg tklingenberg at lastflood.net
Mon Apr 27 17:11:52 GMT 2009


hi all,

looks like this is related to a changed php configuration on your server.  
this is error reporting related. disable strict errors.

On Mon, 27 Apr 2009 16:08:21 +0200, Silverstein, Jesse  
<Jesse.Silverstein at xerox.com> wrote:

> Good catch. For an immediate fix, for each of the line numbers it lists,
> in the wp-includes/widgets.php put an @ in front of apply_filters(...);
>
> i.e. $variable = @apply_filters('some_filter_name', $variable, &$this);

I would not suggest that. there are already too many @s in there. instead  
of that, configure your php setup. do the according ini-setting. or do  
what really is suggested: disable strict error reporting:

/**
  * 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);
	error_reporting($orig);

	// 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();

you can put it on top of wp-config.php. should do the job.

>
> I haven't looked into why $this is being passed by reference. Maybe a
> Dev or someone who already knows can comment?

all that is related to php 4 issues. as long as wordpress stays php 4  
(yes, it is php 4 code), you will encounter those problems on php 5  
installations. when php 4 compability is dropped, this will change. until  
then, disable strict error reporting or do the ini setting to call-time  
pass-by-referenceenable.


-- Tom


>
> -Jesse
>
> -----Original Message-----
> From: wp-testers-bounces at lists.automattic.com
> [mailto:wp-testers-bounces at lists.automattic.com] On Behalf Of Garrett
> Fitzgerald
> Sent: Monday, April 27, 2009 10:01 AM
> To: wp-testers at lists.automattic.com
> Subject: [wp-testers] Bleeding-edge errors on my blog
> [...]


More information about the wp-testers mailing list