PHP Deprecated errors won't disappear on WordP

2019-08-10 11:20发布

TL;DR : Upgraded PHP on our server which caused a bunch of Deprecated errors to appear in WordPress, tried a number of fixes but the errors won't go away.

PHP Version: 5.3.10 WordPress Version: 3.3.2

I have a WordPress installation that has been up and running for a little while now, with no complaint.

This week, we upgraded PHP on the server to 5.3.10, after the update, the WordPress Dashboard began filling up with errors like this:

Deprecated: Assigning the return value of new by reference is deprecated in /home/random/public_html/wp-includes/class-simplepie.php on line 738

A large number (I suspect 116) of errors like this (each on a different line) appear in

  • Incoming Links
  • WordPress Blog
  • Plugins

As advised by a number of posts around the WordPress forums, I disabled error reporting both at a file level (by adding error_reporting(0); to the top of wp-config.php and/or other files) and using PHP.ini. Phpinfo confirms that error_reporting = 0.

This had no effect, with the warnings still showing up on the dashboard.

I tried disabling all of my plugins and reverting to the default theme (with a mind to enable each one in turn to see if one of them was causing the issue) but the errors continued to appear.

Next, instead of treating the symptom, I went to see if I could fix the cause of the issue.

Getting deprecated error with Simplepie

and

Assigning the return value of new by reference is deprecated

pointed to class-simplepie.php having some out of date syntax inside.

Using find/replace in my text editor I swapped all 166 instances of

=& new

for

= new

And I am still seeing errors on my dashboard.

So, as far as I can see, there should be no errors to report, and if there were, they shouldn't be showing up anyway.

Wordpress is not running in debug mode.

A paste of my phpinfo can be found here: http://pastebin.com/Pk68sDL1 if it is of any use to anyone.

Not sure what to try next. Any tips much appreciated.

D

4条回答
我命由我不由天
2楼-- · 2019-08-10 12:02

try this and u will not have this errors:

error_reporting(0);
ini_set("display_errors", "off");
ini_set("display_startup_errors", "off");

Or set the same directives in your php.ini file in your server.

查看更多
Evening l夕情丶
3楼-- · 2019-08-10 12:04

I was having the exact same problem today and I also tried all of the solutions you listed. Eventually I realized that after I replaced

=& new

with

= new

in class-simplepie.php, I also needed to reload the modules in the dashboard. This doesn't seem to happen when you just refresh the browser page, or even hide the module and then show it again.

So I highlighted the Incoming Links module on the Dashboard and clicked Configure. I changed the RSS feed URL to anything else (google.com), hit Submit, and it worked. Refreshed that module with no more deprecated errors from class-simplepie.php. Did the same for the Wordpress Blog module and that also worked.

The only thing I cannot figure out is how to refresh the Plugins module. It doesn't have a Configure option and I can't get it to reload like the others.

Edit: Plugins module works now as well. Just needed time to reset.

查看更多
劫难
4楼-- · 2019-08-10 12:12

I had these warnings as well. I stumbled across a message by a developer of simplepie that this happens with PHP5.3+ and is related to the compatibility to PHP4. Using simplepie v1.3-dev drops this downwards-compatibility and fixes that.

Download from GitHub

查看更多
闹够了就滚
5楼-- · 2019-08-10 12:17

Add this to the top of your wp-config.php file, right after the first

error_reporting(0);
查看更多
登录 后发表回答