Deprecated: Function eregi() is deprecated in...

Do you have some old Joomla site (pre Joomla 1.5.6)? then is very likely you will got - or already have - a site running only halfway, full of errors saying

Deprecated: Function eregi() is deprecated in somecomponent...

or

Warning: Parameter 3 to showItem() expected to be a reference, value given in /home/someaccount/www/www/joomla/includes/Cache/Lite/Function.php on line 100

 

Yeah, you might allready guessed it, the PHP 4.* end of life-cycle is wreaking havoc in Joomla 1.0 sites and some early Joomla 1.5 implementations - or even newer sites, having badly coded third party extensions installed.

Recently had some hot days, as my preferred hosting company decision, to upgrade all their servers hit the one I am using it most. When disaster stroked, and I was flooded by messages by couple of customers who neglected - despite my warnings - to upgrade/migrate their sites to newer Joomla version, I found out, that the sites can be put on float-line again with relatively little coding effort. The early Joomla 1.5 sites where easier - here a simple upgrade to latest Joomla 1.5 generally solved the problems. With Joomla 1.0 sites the situation was a bit trickier. Here one must make his hands dirty with code. In most of cases the culprit is the deprecated "eregi()" PHP function.

The errors caused by this can be relatively easily fixed, by hunting down the instances of it, and making a simple replacement. Old code:

eregi('SOMESTRING', something, somethingelse);

New code:

preg_match('/SOMESTRING/i', something, somethingelse);

The case of the other culprit, the erroneous code found in /includes/Cache/Lite/Function.php is a bit trickier, for that I used a code found in the Joomla forum. Thank you, Kjell Hählen for the great fix.

 

For your convenience I put the files wich must be hacked in a zip file and attached it here: you need just to replace them in your Joomla 1.0 site. zipJoomla 1.0 PHP 5.3 fixes11.14 KB