As per the PHP7 incompatible changes: http://php.net/manual/en/migration70.incompatible.php
New objects cannot be assigned by reference
The result of the new statement can no longer be assigned to a
variable by reference: <?php class C {} $c =& new C; ?>
Output of the above example in PHP 5:
Deprecated: Assigning the return value of new by reference is
deprecated in /tmp/test.php on line 3
Output of the above example in PHP 7:
Parse error: syntax error, unexpected 'new' (T_NEW) in /tmp/test.php
on line 3
There is no alternative. You were using deprecated behavior, and now it's no longer valid PHP. Simply don't assign by reference.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…