0WordPress的标志固定: 在WordPress的仪表板已过时PHP错误

今天早些时候,我更新了我们的测试网站, 在滚动更新到主整地。这涉及到更新几个插件和更换用的Jetpack的“BeforeTheDeadline”插件。完成更新后,我发现我是在仪表盘上越来越多条错误消息, 在“导入链接”仪表盘小工具, 当我试图清空W3的总缓存缓存甚至更多的错误.

The most com­mon error was as below or sim­il­ar to below (which was the error shown on the dashboard)

Deprec­ated: Assign­ing the return value of new by ref­er­ence is deprec­ated in …/wp-includes/class-simplepie.php

I was able to clear the errors by deac­tiv­at­ing all plu­gins, and re-enabling 1 at a time to lead me to the cul­prit — an update to the “WP Auto Affil­i­ate Links” plu­gin we use to insert links to amazon for some products. A bit more research and a com­par­is­on of the code between the old plu­gin and new ver­sion led me to a fix fairly swiftly — the plu­gin con­tains some code near the top which turns on 的PHP 错误.

error_reporting(E_ALL & ~E_NOTICE);

Remov­ing this line (or com­ment­ing it) com­pletely resolved the problem.

As a fur­ther note — these warn­ings from 的PHP are nor­mal for any­one run­ning word­press on an up-to-date PHP5 because word­press includes lots of leg­acy code which uses func­tions which are now deprec­ated. The reas­on they aren’t nor­mally shown is because non fatal errors are usu­ally sup­pressed. It’s high time word­press updated this leg­acy code, but that is a dis­cus­sion for anoth­er time. In the mean­time — if you start to get these errors after a plu­gin update you need to check the plu­gin code and edit out any lines that include the error_reporting() func­tion call.

In the pro­cess of resolv­ing this issue I also dis­covered some­thing else quite use­ful. When I wanted to obtain the pre­vi­ous ver­sion of the auto affil­i­ate links plu­gin I dis­covered that these are all archived on the wordpress.org down­loads page. The cur­rent ver­sion (在写作时) 是 2.3.2 which can be down­loaded from http://downloads.wordpress.org/plugin/wp-auto-affiliate-links.2.3.2.zip. My pre­vi­ous ver­sion was 2.2.2 — so I guessed the down­load link would be http://downloads.wordpress.org/plugin/wp-auto-affiliate-links.2.2.2.zip if old ver­sions were retained. Hey presto — using that address worked per­fectly, kudos to word­press for keep­ing old versions.

认为我们已经错过了什么? 让我们通过下面的评论知道. 如果您想订阅,请使用菜单上的订阅链接右上方. 您还可以通过使用下面的链接社会分享这与你的朋友. 干杯.