Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP based project is throwing error saying " return value of new by Reference is Deprecated"

Tags:

cakephp

I have upgraded my Xampp to newer version(1.7.2).But right now when I run my project(done in CakePHP) it is throwing bug saying

Deprecated: Assigning the return value of new by reference is deprecated in
C:\xampp\htdocs\ebayn\cake\libs\debugger.php on line 99

Deprecated: Assigning the return value of new by reference is deprecated in 
C:\xampp\htdocs\ebayn\cake\libs\debugger.php on line 108

Deprecated: Assigning the return value of new by reference is deprecated in 
C:\xampp\htdocs\ebayn\cake\libs\file.php on line 96

Deprecated: Assigning the return value of new by reference is deprecated in
C:\xampp\htdocs\ebayn\cake\libs\cache\file.php on line 89

Can anyone help me how can I rectify this stuff....???

Thanks In Advance

like image 449
Bindas Avatar asked Aug 20 '09 14:08

Bindas


3 Answers

You need to patch the cake/libs/configure.php and find the line "error_reporting(E_ALL);" replace that line with the following:

error_reporting(E_ALL & ~E_DEPRECATED);

You may need to change this in your app/webroot/index.php and respectively test.php, too.

There is currently no better way than to touch the core.

like image 196
nanoman Avatar answered Nov 07 '22 17:11

nanoman


You don't mention your CakePHP version, but if you use PHP 5.3 (which is part of Xampp 1.7.2) then you have to use CakePHP 1.3.x.x.

like image 4
dhofstet Avatar answered Nov 07 '22 18:11

dhofstet


You haven't included any code, but it looks like you may be attempting to assign a variable by reference - probably an instance of an object. In PHP 5+, that's the default, as I recall. In 5.3, they may have officially deprecated the practice.

If your app has to work with PHP 4, you may want to look at your error_reporting setting. If E_STRICT is set, turn it off. I don't recall which settings effect which types of errors, but that particular value will probably be instructive if I were to guess.

like image 2
Rob Wilkerson Avatar answered Nov 07 '22 19:11

Rob Wilkerson