Fixing Joomla 1.0 for php 5.3.x

Joomla > Core

Joomla 1.0 has a few things that break under PHP 5.3.x, as a number of users have found over time.

Obviously, it's recommended that developers now take the time to upgrade their Joomla sites to 1.5 at least, and ideally now Joomla 1.6 as Joomla 1.5 has reached it's end of development life, and most major components are now available for Joomla 1.5.

Following upgrading my version of PHP recently, I needed to do my homework, and have found a few simple workarounds to get Joomla 1.0 functioning on PHP 5.3.x until I can get to the stage where I can update the last few sites I have in Joomla 1.0.

Note that only core Joomla 1.0 filexes are outlined in this article. If you are encountering problems with Joomla 1.0 templates developed by third parties, visit the third party's website to diagnose and fix the issue (if they have a solution) or upgrade your 1.0 site to a newer version of Joomla.

To make joomla 1.0.x compatible to PHP 5.3.x, there's a few steps.

First up, if you're getting content not showing on most pages, go to Function.php files  your directory on /public_html/includes/Cache/Lite.

Then replace:

$arguments = func_get_args();

with

$arguments = func_get_args();
$numargs = func_num_args();
for($i=1; $i < $numargs; $i++){
$arguments[$i] = &$arguments[$i];
}

in includes/Cache/Lite/Function.php. It fixes compatibility view issues for Joomla 1.0.x on php 5.3.x.

Original Post explaining the cache lite fix is here.

com_contact White Screen / vcard.class.php error

Depending on which other components you have in your 1.0 site, there may be other items to be fixed.

com_contacts uses the includes/vcard.class.php file, which also needs to be modified to avoid this error:

Fatal error: Cannot redeclare quoted_printable_encode() in includes/vcard.class.php on line 74

In vcard.class.php around line 36 is the function quoted_printable_encode. This ends up declaring twice, causing the error, so you can prevent the error and fix the error by checking if the function already exists, and if it does, PHP ignores the function declaration. Adding the green lines of code before and after the existing function clears the problem.

if(!function_exists('quoted_printable_encode')) {
 function quoted_printable_encode($input, $line_max=76) {
/* ... */
}
}

Original post for helping with this solution.

Timezones

Another PHP 5.3 change is to how the timezones are set.

The easiest solution I've found for fixing that aspect is to place some timezone code in the .htaccess file for your site. Assuming you're using it for SEF URLs already, it will have been renamed from htaccess.txt, so you should just need to edit your .htaccess file.

Add the following, chaning your timezone to your required timezone:

# set the server timezone
SetEnv TZ Australia/Victoria

Original post for helping with this solution. For a full list of timezones, see the PHP Reference Manual.

 

Deprecated: Function eregi() is deprecated in includes/sef.php on line 533

Additional Info: September 29 2011

The functionality of eregi in newer php versions is performed by changing to the preg_match function, then modifying some of the regular expressions used in the function.

You can download the fix for the SEF.PHP problem via the original post link below, or manually change the 5 lines as follows.

Line 370:

WAS:

     if ($juri != '' && $juri != '/' && !eregi( "index\.php", $_SERVER['REQUEST_URI'] ) && !eregi( "index2\.php", $_SERVER['REQUEST_URI'] ) && !eregi( "/\?", $_SERVER['REQUEST_URI'] ) && $_SERVER['QUERY_STRING'] == '' ) {

BECOMES:

     if ($juri != '' && $juri != '/' && !preg_match( "index\.php/i", $_SERVER['REQUEST_URI'] ) && !preg_match( "index2\.php/i", $_SERVER['REQUEST_URI'] ) && !preg_match( "/\?/i", $_SERVER['REQUEST_URI'] ) && $_SERVER['QUERY_STRING'] == '' ) {

Line 388:

WAS:

if( $mosConfig_sef && $mosConfig_multilingual_support && $string!='index.php' && !eregi("^(([^:/?#]+):)",$string) && !strcasecmp(substr($string,0,9),'index.php') && !eregi('lang=', $string) ) {

BECOMES:

if( $mosConfig_sef && $mosConfig_multilingual_support && $string!='index.php' && !preg_match("^(([^:/?#]+):)/i",$string) && !strcasecmp(substr($string,0,9),'index.php') && !preg_match('lang=/i', $string) ) {

Line 393:

WAS:

if ($mosConfig_sef && !eregi("^(([^:/?#]+):)",$string) && !strcasecmp(substr($string,0,9),'index.php')) {

BECOMES:

if ($mosConfig_sef && !preg_match("/^(([^\/:?#]+):)/i",$string) && !strcasecmp(substr($string,0,9),'index.php')) {

Line 409:

WAS:

if (preg_match('@^[A-Za-z][A-Za-z0-9:_.-]*$@', $url['fragment'])) {

BECOMES:

if (preg_match('@^[A-Za-z][A-Za-z0-9:_.-]*$@/i', $url['fragment'])) {

Line 533:

WAS:

eregi("^(https?:[\/]+[^\/]+)(.*$)", $mosConfig_live_site, $live_site_parts);

BECOMES:

preg_match("/^(https?:[\/]+[^\/]+)(.*$)/i", $mosConfig_live_site, $live_site_parts);

Original Post: http://www.translatum.gr/forum/index.php?topic=123457.0


 

Comments  

 
0 #14 Matthias 2012-02-18 07:38
Fantastisch! Vielen Dank!
Quote
 
 
0 #13 Green Dude 2012-01-07 21:23
Thanks pal. You made da green dude happy! :-)
Quote
 
 
0 #12 Jan 2012-01-01 01:36
Thanks man, happy 2012
Quote
 
 
0 #11 Vlavio 2011-12-17 21:31
Keep up the great work!! this fixed my problem:)
Quote
 
 
0 #10 Alvin 2011-12-08 21:36
Thanks That`s really save me. :lol:
Quote
 
 
0 #9 Piotr 2011-12-02 20:40
First two hacks were really helpfull. THANK YOU! :D
Quote
 
 
0 #8 Lucy 2011-11-12 01:28
Thanks a lot, I wasted lot of time because of this problem. Now everything works fine!
Quote
 
 
0 #7 David 2011-11-06 09:27
Thank you so much. My wife ask me to look into this for her web site and thanks to you I will have a fantastic week end!
Quote
 
 
0 #6 claudiu 2011-10-12 05:36
Thank you thank you thank you
help me to much ,
THnak you gain
Quote
 
 
0 #5 Giorgos K 2011-10-07 01:13
Thank you very much for the great hacks.
Everything worked very nice for my site.

Giorgos K
Patras, Greece
Quote
 

Add comment


Security code
Refresh