Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Function eregi() is deprecated


Guest

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

Link to comment
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.

Link to comment
Share on other sites

  • 3 months later...

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

Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

  • 3 months later...

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

Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 2 weeks later...

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

Link to comment
Share on other sites

  • 1 month later...
  • 6 months later...

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

Link to comment
Share on other sites

  • 5 months later...

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.

Link to comment
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.

Link to comment
Share on other sites

  • 4 weeks later...

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://www.oscommerce.com/forums/topic/381320-since-were-updating-deprecated-session-and-ereg-solutions/page__hl__eregi__fromsearch__1

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...