0Logo WordpressFixo: erros PHP Reprovados no painel do WordPress

Earli­er today I updated our test site, in pre­par­a­tion for rolling updates out to the main site. This involved updat­ing sev­er­al plu­gins and repla­cing the “BeforeTheDead­line” plu­gin with Jet­pack. After com­plet­ing the updates I found I was get­ting sev­er­al error mes­sages on the dash­board, under the “incom­ing links” dash­board wid­get, e até mesmo mais erros quando tentei esvaziar os caches W3 Total Cache.

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

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 erros.

error_reporting(E_ALL & ~E_NOTICE);

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

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 (no momento do writ-ing) é 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 ver­sions.

Acho que perdemos algo? Deixe-nos saber por comentar abaixo. Se você deseja se inscrever, use o link de inscrição no menu no canto superior direito. Você também pode compartilhar isso com seus amigos usando os links sociais abaixo. Felicidades.

Deixe uma resposta