Sunday, January 23, 2011

CodeIgniter PHP5.3

PHP Deprecated: Assigning the return value of new by reference is deprecated in


To be able to run your CodeIgniter application under PHP 5.3 you have to do the following:

cd /path/to/codeigniter/system;
#this changes by ref assignments to by value(?)
sed -i 's/=&/=/g' */*.php;
sed -i 's/=&/=/g' database/*/*/*.php;

sed -i 's/@set_magic_quotes_runtime/#@set_magic_quotes_runtime/g' codeigniter/CodeIgniter.php;
sed -i 's/set_magic_quotes_runtime/#set_magic_quotes_runtime/g' codeigniter/CodeIgniter.php;


I'm sure there's a better way(correct regexp) to replace set_magic_quotes_runtime. It takes into account if theres @ or not, older CI systems don't have @. As long as the call to set_magic_quotes_runtime doesn't execute is fine. Your app will function.

This is a quick and dirty way to make your app work after you upgrade to php 5.3.3. you can always make that change manually.