php7でpear/http_requestが動かなくなった

 thunarの右クリックからはてなフォトライフにアップロードするスクリプトが動かなくなった。いわく

PHP Parse error: syntax error, unexpected 'new' (T_NEW) in /usr/share/php/HTTP/Request.php on line 412

 http_resuest2をインストールして、スクリプトもちょこちょこと変えてみるが、うまく動かない。

 このエラーメッセージで検索してみる。

codecaveme.de

The solution was pretty easy. Just open an editor on the file and line PHP tells you. Now you should see something like

$this->smilies =& new smilies_package($this->current_smilies);

Here they made some changes in PHP 7. You can’t assign classes with a & symbol anymore. So just remove that & symbol and the plugin will work fine again (search for multiple occurences).

Here you go, have fun with very fast working new PHP 7 and your (old) WordPress !

 なんかわかりにくいが、Resuest.phpの中に&newがあった。この&を取ってみたら元のように動くようになった。

 ほんまはhttp_request2に移行すべきなんやろうけど。