Your problem is with the =&
, which should be simply =
, in $obj =& new ...
. Objects can't, shouldn't, and don't need to, be created by reference. Such an expression was deprecated in PHP 5 and made invalid in PHP 7 (see eval
response on different PHP versions).
It's a mystery to me why the PEAR package should have this, it must be a vestige from forever ago. It makes no more sense than $x =& [];
(which would also result in an error). When an object is assigned to a variable, the variable becomes a pointer to the object. Therefore:
$a = new stdClass();
var_dump($a);
// object(stdClass)#1 (0) {}
$b = $a;
var_dump($b);
// object(stdClass)#1 (0) {}
var_dump($a === $b);
// bool(true)
That is: even without assigning $b =& $a
, both variables point to the same object by default (ie. to object(stdClass)#1
). Clean those up and drop a note to the PEAR package maintainers. FYI, the MDB2_Driver_mysqli package was last updated on 2012-10-23, so fetching the latest updates won't help much. Look for an up-to-date replacement. (Core PHP has had mysqli
built in since PHP 5 and also has PDO if you need code portability between different RDBMs).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…