So you’ve run into this error message, sometimes in WordPress or another CMS that utilizes code that is considered depreciated. This is sometimes caused by an update to PHP – which is what’s happened in this case. Essentially, Since PHP 5.3 assigning the return value is depreciated.
In WordPress, in your Admin dashboard, you may see several error messages under Incoming Links and WordPress Blog – not critical errors, just warnings. It was annoying, and instead of trying to workaround it by turning off error reporting, I wanted to actually fix the issue and find a working solution.
When doing some research on this, I’ve come to realize that “$var =& new …” and “$var = new …” are NOT equivalent, as suggested in several places. Removing the ampersand in some cases actually broke the code, and in fact it seems that the statment with the ampersand is the one that does not create a reference.
In WordPress, there’s a class called SimplePie – it contains code that is PHP4 compliant, but hasn’t yet been switched over to PHP5. The file is called class-simplepie.php. Open it in your favourite text editor (I use Notepad++).
For example, you will see something like this:
$this->sanitize =& new SimplePie_Sanitize;
in PHP 5.3+, it needs to look like this:
$obj = new SimplePie_Sanitize;
$this->sanitize =& $obj;
But wait! This doesn’t solve your issue you say? In some instances I had to replace the =& with = as well, and I found I actually had to go and click on “Configure” next to Incoming Links, then hit submit before it would show the changes I made. Since WordPress has no built-in caching system, I find this behavior strange, but at least we know it works.
Or, if you prefer, I’ve done the work for you. Here’s a link to download the actual file itself, zipped: Download Here
Hope this helps!
Leave A Comment