bbPress

bbPress の移行で謎のエラー

bbPress を新しい環境に移植したら以下のエラーが出るようになった。

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\wpc\bbpress\bb-includes\backpress\functions.wp-object-cache.php on line 108
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\wpc\bbpress\bb-includes\backpress\pomo\mo.php on line 171
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\wpc\bbpress\bb-includes\functions.bb-l10n.php on line 484
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\wpc\bbpress\bb-includes\backpress\class.wp-taxonomy.php on line 581

但し、エラーが出てくるだけで動作上は問題無い。

そのため、Deprecated というエラーを出さないように bb-settings.php に以下の記述を追加。

error_reporting(E_ALL & ~E_DEPRECATED );

すると、Deprecated のエラーは消えたが、今度は新しいエラー Notice がたくさん出てくる。

Notice: Undefined variable: r in C:\xampp\htdocs\wpc\bbpress\bb-includes\functions.bb-template.php on line 1138
Notice: Undefined variable: r in C:\xampp\htdocs\wpc\bbpress\bb-includes\functions.bb-template.php on line 1138
Notice: Undefined variable: r in C:\xampp\htdocs\wpc\bbpress\bb-includes\functions.bb-template.php on line 1138

これも動作上は問題無いように見えるために、Notice も消すようにさらにbb-settings.php 内の記述を以下のように変更した。

error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);

本来はエラーを見えなくする。というのは気持ちが良いものでは無いが、元をたどって修正していくのが大変そうなので・・・という事で。

error_reporting という PHP関数については、以下にリファレンスがある。

PHP: error_reporting - Manual

-bbPress

Copyright© エンジニアの何でもメモ帳 , 2024 All Rights Reserved.