-
AuthorPosts
-
Grumpster Friend
Grumpster
- Join date:
- June 2006
- Posts:
- 14
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 8 times in 1 posts
December 3, 2009 at 7:08 pm #146564I installed this template on my local WAMP installation and got some errors due to the new version of PHP 5.3. I got this error:
Error #1: Deprecated: Function eregi() is deprecated in templatesja_kyanite_iilibsmobile_device_detect.php on line 52
And this error:
Error #2: Deprecated: Function split() is deprecated in templatesja_kyanite_iilibsmenubase.class.php on line 239
And this error:
Error #3: Deprecated: Function eregi() is deprecated in modulesmod_jaslideshow2helper.php on line 163
And finally, this error:
Error #4: Deprecated: Function split() is deprecated in modulesmod_jaslideshow2mod_jaslideshow2.php on line 29
Fix Error # 1:
To solve error #1, Deprecated Function eregi(), open up your templatesja_kyanite_iilibsmobile_device_detect.php file. The problem is that eregi is no longer supported in PHP 5.3, so you have to replace it with preg_match. There are several you have to change, plus you have to escape the single quotes, so on or around line 52 where you’ll see this:
case (eregi(‘ipod’,$user_agent)||eregi(‘iphone’,$user_agent));
Change it to this:
case (preg_match(‘/ipod/’,$user_agent)||preg_match(‘/iphone/’,$user_agent));
The red bits are what were changed / added.
Basically, wherever you see eregi change it to preg_match, then put forward slashes in front of any single quotes on the same line. If your file is like mine, then you have to do it for lines 59, 66, and 73 as well (your line numbers may vary!).
Line 59: case (preg_match(‘/android/’,$user_agent));
Line 66: case (preg_match(‘/opera mini/’,$user_agent));
Line 73: case (preg_match(‘/blackberry/’,$user_agent));That should fix your eregi deprecated errors, now you have to fix the second error regarding the use of the deprecated split function.
Fix Error #2:
Open up templatesja_kyanite_iilibsmenubase.class.php
On lines 215, 223, and 231 you’ll see the problems (your line numbers may vary!):
Line 215: $ids = split (‘,’, $modid);
Change that to $ids = explode (‘,’, $modid);
Line 223: $names = split (‘,’, $modname);
Change that to $names = explode (‘,’, $modname);
Line 231: $poses = split (‘,’, $modpos);
Change that to $poses = explode (‘,’, $modpos);
Fix Error #3:
Open up modulesmod_jaslideshow2helper.php and find this line on or around line 163:
if ( eregi( “bmp|gif|jpg|png|jpeg”, $file ) && is_file( $i_f ) ) {
Change it to this …
if ( preg_match( “/bmp|gif|jpg|png|jpeg/”, $file ) && is_file( $i_f ) ) {
Fix Error #4:
Open modulesmod_jaslideshow2mod_jaslideshow2.php and find the following on or around line 29:
$thumbSpaces = split(‘:’, $thumbSpace);
Change it to this …
$thumbSpaces = explode(‘:’, $thumbSpace);
That’s it. Save all your files and reload your site and all should be working.
5 users say Thank You to Grumpster for this useful post
January 3, 2010 at 4:42 pm #328027On the first fix_error section i think you forgot to chnage the color of the second “preg_match” word. A little detail. Thank you for the solution by the way.
Phill ModeratorPhill
- Join date:
- February 2014
- Posts:
- 7013
- Downloads:
- 40
- Uploads:
- 77
- Thanks:
- 917
- Thanked:
- 2206 times in 1818 posts
January 3, 2010 at 7:02 pm #328033There are a number of JA templates and extensions that use eregi() and I have pointed out a few in the past. That said however, the function still works (it is recommended no to use it as it will be dropped come PHP6) and the error messages only show if you have display errors switched on. Most people will not have this enabled so at the moment it will not affect the majority of users. The PHP team have obviously thought long and hard about this so are giving developers a long time to adjust their code.
January 9, 2010 at 7:46 am #328777already test it . but some bug wehenn i using opera mini the default template is iphone ..
this the codecase (preg_match(‘/opera mini/’,$user_agent)); // we find opera mini in the user agent
$mobile_browser = $opera; // mobile browser is either true or false depending on the setting of opera when calling the function
$status = ‘Opera’;
if(substr($opera,0,4)==’http’){ // does the value of opera resemble a rul
$mobileredirect = $opera; // set the mobile redirect url to the url value stored in the opera value
} // ends the if for opera being a url
break; // break out and skip the rest if we’ve had a match on operaJanuary 9, 2010 at 11:36 pm #328837This is awesome, thank you for posting it.
I was getting these errors using JA Lead and although the line numbers were different for the deprecation errors, as the module causing the error was the same, your fixes for #3 and #4 did the trick on JA Lead as well.
January 10, 2010 at 12:08 am #328840<em>@phill luckhurst 158764 wrote:</em><blockquote>There are a number of JA templates and extensions that use eregi() and I have pointed out a few in the past. That said however, the function still works (it is recommended no to use it as it will be dropped come PHP6) and the error messages only show if you have display errors switched on. Most people will not have this enabled so at the moment it will not affect the majority of users. The PHP team have obviously thought long and hard about this so are giving developers a long time to adjust their code.
http://php.net/manual/en/function.eregi.php</blockquote>
I was able to correct some of my errors for the JA Lead template on local host running latest version of Wamp but I still have more errors on many other modules as follows:Deprecated: Function split() is deprecated in C:wampwwwconcomodulesmod_ja_contentslidemod_ja_contentslide.php on line 53
Deprecated: Function split() is deprecated in C:wampwwwconcopluginscontentja_tabsparser.php on line 87
Deprecated: Function split() is deprecated in C:wampwwwconcomodulesmod_janewsmod_janews.php on line 49
I used the fixes above but you mention something above about switch error message on. Where do you turn it off since you indicate that the functions do in fact work.
-
AuthorPosts
This topic contains 6 replies, has 5 voices, and was last updated by littlefolk 14 years, 10 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum