PHP Deprecated errors won't disappear on WordPress Dashboard

做~自己de王妃 提交于 2019-12-11 08:23:37

问题


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


回答1:


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.




回答2:


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.




回答3:


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




回答4:


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

error_reporting(0);


来源:https://stackoverflow.com/questions/10722381/php-deprecated-errors-wont-disappear-on-wordpress-dashboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!