我刚从php 5.1升级到5.3,之前在我的服务器上使用过cakephp 1.1.自升级(或可能更早,我无法确定),我收到以下错误.任何人都可以解释一下:
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/dispatcher.php on line 157
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/dispatcher.php on line 221
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/controller/controller.php on line 308
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/controller/controller.php on line 347
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/controller/controller.php on line 535
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/controller/controller.php on line 805
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/controller/component.php on line 128
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/view/view.php on line 686
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/class_registry.php on line 55
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/model/connection_manager.php on line 84
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/libs/model/connection_manager.php on line 107
解决方法:
基本上它说的是:你(在这种情况下)你试图做的是什么仍然可以在这个版本中工作,但可以在未来的PHP版本中删除.
您应该将cakephp升级到更新版本.您还可以禁止警告:
error_reporting(E_ALL & ~E_DEPRECATED);
但这样做的危险在于你忘记它并且你的网站在下次升级php时没有警告就停止工作.