Jump to content

Archived

This topic is now archived and is closed to further replies.

nronnie

Function eregi() is deprecated

Recommended Posts

After installing OS Commerce in my local system I got the following error or message:

 

Deprecated: Function eregi() is deprecated in C:\wamp\www\catalog\includes\classes\language.php on line 87

 

The line 87 : if (eregi('^(' . $value . ')(;q=[0-9]\\.[0-9])?$', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {

88: $this->language = $this->catalog_languages[$key];

89: break 2;

}

 

Please help.

 

Thanks in advance

 

Ronnie

Share this post


Link to post
Share on other sites

See if this works

 

		  if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$/i', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
		$this->language = $this->catalog_languages[$key];

 

ereg is deprecated in PHP 5.3 but I don't have PHP 5.3 so I don't know if that will work.

Share this post


Link to post
Share on other sites

After installing OS Commerce in my local system I got the following error or message:

 

Deprecated: Function eregi() is deprecated in C:\wamp\www\catalog\includes\classes\language.php on line 87

 

The line 87 : if (eregi('^(' . $value . ')(;q=[0-9]\\.[0-9])?$', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {

88: $this->language = $this->catalog_languages[$key];

89: break 2;

}

 

Please help.

 

Thanks in advance

 

Ronnie

 

I also got the same issue. really no idea about this. i am a fresh

Share this post


Link to post
Share on other sites

Go to sourceforge.net and look for an older version of WAMP.

 

--OR--

 

Download and install an older version of XAMPP. Download instructions ->here

Share this post


Link to post
Share on other sites

Hi,

 

 

please i need a link to download and install PHP 5.2.x on a MS Windows machine using a the latest WAMP server

.

 

 

Thank you so much

Share this post


Link to post
Share on other sites

You're much better off fixing your osC code to avoid "deprecated function" warnings than to downgrade PHP levels. It's not a lot of work, and when PHP 6.0 finally rolls out, you won't be caught with your pants down (you will have to fix osC at that point). In the mean time, search around for the magic spell to suppress "deprecated" errors (I seem to recall something about an ini.set call with ~DEPRECATED added to it). Just don't forget to get around some time to updating osC.

Share this post


Link to post
Share on other sites

See if this works

 

if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$/i', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {

$this->language = $this->catalog_languages[$key];

 

 

 

ereg is deprecated in PHP 5.3 but I don't have PHP 5.3 so I don't know if that will work.

Thanks buddy.

rally amazing solution.

now its working proper. really good solution

Share this post


Link to post
Share on other sites

See if this works

 

		  if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$/i', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
		$this->language = $this->catalog_languages[$key];

 

ereg is deprecated in PHP 5.3 but I don't have PHP 5.3 so I don't know if that will work.

Share this post


Link to post
Share on other sites

For future reference, I have uploaded complete instructions and all 24 'drop on top' files for RC2a to make the site PHP 5.3 compatible. You can find it here:

 

 

http://addons.oscommerce.com/info/7394

 

 

Chris


:|: Was this post helpful ? Click the LIKE THIS button :|:

 

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

Share this post


Link to post
Share on other sites

Lindsay,

 

No thanks needed as I did not write the contents of that download, I simple compiled information already available on the GITHUB repository and placed them in the add-on area to help members resolve their PHP 5.3 compatibility issues.

 

All thanks goes to the original authors and the OSC Development Team. :thumbsup:

 

 

 

 

Chris


:|: Was this post helpful ? Click the LIKE THIS button :|:

 

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

Share this post


Link to post
Share on other sites

Not sure why you would choose to downgrade, but I wouldn't use any version older than RC2a. If you choose to use RC2a, ensure you read the security forums to ensure the site includes all of the security patches and recommended contributions.

 

I DO suggest that you use v2.3.1 as it contains all of the patches and has a stronger base code.

 

 

 

 

Chris


:|: Was this post helpful ? Click the LIKE THIS button :|:

 

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

Share this post


Link to post
Share on other sites

Hi,

 

I am new to php..

can someone help me with this

 

$email_body_no_url = eregi_replace('\[url\]','',eregi_replace('\[/url\]','',$email_body));

Share this post


Link to post
Share on other sites

If it's to get rid of the deprecated functions warnings, downgrade PHP to 5.2. However, in the long run you'll be a lot better off upgrading osC to 2.3.1 (with PHP 5.3) or fixing the osC code to use non-deprecated functions.

Share this post


Link to post
Share on other sites

$email_body_no_url = eregi_replace('\[url\]','',eregi_replace('\[/url\]','',$email_body));

If you search around a bit, you'll find lots of discussion on this subject. To fix this particular case,

$email_body_no_url = preg_replace('/\[url\]/i', '', preg_replace('/\[/url\]/i', '', $email_body));

I think that's the proper incantation. You can check at www.php.net and look up the preg_replace and eregi_replace function syntax.

Share this post


Link to post
Share on other sites

See if this works

 

		  if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$/i', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
		$this->language = $this->catalog_languages[$key];

 

ereg is deprecated in PHP 5.3 but I don't have PHP 5.3 so I don't know if that will work.

 

THANK YOU!

Спасибо,

Landis.

 

p.s., I also needed this:

http://forums.oscommerce.com/topic/381320-since-were-updating-deprecated-session-and-ereg-solutions/page__hl__eregi__fromsearch__1

Share this post


Link to post
Share on other sites

×