XOOPS Cube Legacy 2.1を無理やりPHP5.3に対応する
古いパッケージですが
XOOPS Cube Legacy 2.1を無理やりPHP5.3に対応する
http://xoopscube.jp/forum/6557
http://blog.netandfield.com/shar/2010/12/xoops-cube-legacy-php-53.html
のようにdeprecatedなエラーが画面に表示される
なぜか.htaccessやphp.iniで制限しても表示されるので
# phpのソースに書いてあるのかも(?)
まじめにエラーと向き合う
基本的にこれ
https://php.net/manual/en/migration53.deprecated.php
を見てねですむがログは残しておく
1. "Deprecated: Assigning the return value of new by reference is deprecated in xxx"
そのまま書いてあるとおりなので
リファレンスではなくそのまま返り値にいれる
//$instance =& new $classname();
//を以下に直す
$instance = new $classname();
かなり数が多いので気合で直す
2. "call_user_func_array() expects parameter 1 to be a valid callback, non-static method xxx() should not be called statically in file core/XCube_Delegate.class.php line xxx"
これは第2引数を参照にする
//call_user_func_array($callback, $args);
//を以下に直す
call_user_func_array($callback, &$args);
下記が大変詳しくて参考になる
http://sotarok.hatenablog.com/entry/20090826/1251312215
3. "Deprecated: Function ereg() is deprecated in xxx"
eregはpreg_matchで書き換える
//ereg("Windows",$ua); //を以下に直す preg_match("/Windows/",$ua);
4. require_onceでPEAR.phpを/usr/share/pear/PEAR.phpから読もうとする
原因がよくわからないがとりあえずプルパスでファイル名を記述する
//require_once 'PEAR.php'; //を以下に直す require_once '/home/foo/var/xoops_trust_path/xanhte/lib/PEAR.php';