Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error message after install


ulefos

Recommended Posts

Hi

 

i have installed a new oscommerce site on my local machine, i have this error

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

 

<?php
/*
 $Id: language.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License

 browser language detection logic Copyright phpMyAdmin (select_lang.lib.php3 v1.24 04/19/2002)
							   Copyright Stephane Garin <[email protected]> (detect_language.php v0.1 04/02/2002)
*/

 class language {
var $languages, $catalog_languages, $browser_languages, $language;

function language($lng = '') {
  $this->languages = array('ar' => 'ar([-_][[:alpha:]]{2})?|arabic',
						   'bg' => 'bg|bulgarian',
						   'br' => 'pt[-_]br|brazilian portuguese',
						   'ca' => 'ca|catalan',
						   'cs' => 'cs|czech',
						   'da' => 'da|danish',
						   'de' => 'de([-_][[:alpha:]]{2})?|german',
						   'el' => 'el|greek',
						   'en' => 'en([-_][[:alpha:]]{2})?|english',
						   'es' => 'es([-_][[:alpha:]]{2})?|spanish',
						   'et' => 'et|estonian',
						   'fi' => 'fi|finnish',
						   'fr' => 'fr([-_][[:alpha:]]{2})?|french',
						   'gl' => 'gl|galician',
						   'he' => 'he|hebrew',
						   'hu' => 'hu|hungarian',
						   'id' => 'id|indonesian',
						   'it' => 'it|italian',
						   'ja' => 'ja|japanese',
						   'ko' => 'ko|korean',
						   'ka' => 'ka|georgian',
						   'lt' => 'lt|lithuanian',
						   'lv' => 'lv|latvian',
						   'nl' => 'nl([-_][[:alpha:]]{2})?|dutch',
						   'no' => 'no|norwegian',
						   'pl' => 'pl|polish',
						   'pt' => 'pt([-_][[:alpha:]]{2})?|portuguese',
						   'ro' => 'ro|romanian',
						   'ru' => 'ru|russian',
						   'sk' => 'sk|slovak',
						   'sr' => 'sr|serbian',
						   'sv' => 'sv|swedish',
						   'th' => 'th|thai',
						   'tr' => 'tr|turkish',
						   'uk' => 'uk|ukrainian',
						   'tw' => 'zh[-_]tw|chinese traditional',
						   'zh' => 'zh|chinese simplified');

  $this->catalog_languages = array();
  $languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order");
  while ($languages = tep_db_fetch_array($languages_query)) {
	$this->catalog_languages[$languages['code']] = array('id' => $languages['languages_id'],
														 'name' => $languages['name'],
														 'image' => $languages['image'],
														 'directory' => $languages['directory']);
  }

  $this->browser_languages = '';
  $this->language = '';

  $this->set_language($lng);
}

function set_language($language) {
  if ( (tep_not_null($language)) && (isset($this->catalog_languages[$language])) ) {
	$this->language = $this->catalog_languages[$language];
  } else {
	$this->language = $this->catalog_languages[DEFAULT_LANGUAGE];
  }
}

function get_browser_language() {
  $this->browser_languages = explode(',', getenv('HTTP_ACCEPT_LANGUAGE'));

  for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) {
	reset($this->languages);
	while (list($key, $value) = each($this->languages)) {
	  if (eregi('^(' . $value . ')(;q=[0-9]\\.[0-9])?$', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
		$this->language = $this->catalog_languages[$key];
		break 2;
	  }
	}
  }
}
 }
?>

 

i belive i have to change this

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

 

to this

 

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

 

which i have tried but i then get a

Parse Error: syntax error, unexpected '^'in C:\xampp\htdocs\catalog\includes\classes\language.php on line 87

 

I also have the problem in

catalog/admin/configuration

 

Deprecated: Function ereg() is deprecated in C:\xampp\htdocs\catalog\admin\configuration.php on line 80

 

 

Deprecated: Function ereg() is deprecated in C:\xampp\htdocs\catalog\admin\configuration.php on line 80

 

Hopefully someone would be kind enough to point me in the right direction to sort out this mess.

Thanks

 

teresa

Link to comment
Share on other sites

Hi

 

i have installed a new oscommerce site on my local machine, i have this error

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

 

<?php
/*
 $Id: language.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License

 browser language detection logic Copyright phpMyAdmin (select_lang.lib.php3 v1.24 04/19/2002)
							   Copyright Stephane Garin <[email protected]> (detect_language.php v0.1 04/02/2002)
*/

 class language {
var $languages, $catalog_languages, $browser_languages, $language;

function language($lng = '') {
  $this->languages = array('ar' => 'ar([-_][[:alpha:]]{2})?|arabic',
						   'bg' => 'bg|bulgarian',
						   'br' => 'pt[-_]br|brazilian portuguese',
						   'ca' => 'ca|catalan',
						   'cs' => 'cs|czech',
						   'da' => 'da|danish',
						   'de' => 'de([-_][[:alpha:]]{2})?|german',
						   'el' => 'el|greek',
						   'en' => 'en([-_][[:alpha:]]{2})?|english',
						   'es' => 'es([-_][[:alpha:]]{2})?|spanish',
						   'et' => 'et|estonian',
						   'fi' => 'fi|finnish',
						   'fr' => 'fr([-_][[:alpha:]]{2})?|french',
						   'gl' => 'gl|galician',
						   'he' => 'he|hebrew',
						   'hu' => 'hu|hungarian',
						   'id' => 'id|indonesian',
						   'it' => 'it|italian',
						   'ja' => 'ja|japanese',
						   'ko' => 'ko|korean',
						   'ka' => 'ka|georgian',
						   'lt' => 'lt|lithuanian',
						   'lv' => 'lv|latvian',
						   'nl' => 'nl([-_][[:alpha:]]{2})?|dutch',
						   'no' => 'no|norwegian',
						   'pl' => 'pl|polish',
						   'pt' => 'pt([-_][[:alpha:]]{2})?|portuguese',
						   'ro' => 'ro|romanian',
						   'ru' => 'ru|russian',
						   'sk' => 'sk|slovak',
						   'sr' => 'sr|serbian',
						   'sv' => 'sv|swedish',
						   'th' => 'th|thai',
						   'tr' => 'tr|turkish',
						   'uk' => 'uk|ukrainian',
						   'tw' => 'zh[-_]tw|chinese traditional',
						   'zh' => 'zh|chinese simplified');

  $this->catalog_languages = array();
  $languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order");
  while ($languages = tep_db_fetch_array($languages_query)) {
	$this->catalog_languages[$languages['code']] = array('id' => $languages['languages_id'],
														 'name' => $languages['name'],
														 'image' => $languages['image'],
														 'directory' => $languages['directory']);
  }

  $this->browser_languages = '';
  $this->language = '';

  $this->set_language($lng);
}

function set_language($language) {
  if ( (tep_not_null($language)) && (isset($this->catalog_languages[$language])) ) {
	$this->language = $this->catalog_languages[$language];
  } else {
	$this->language = $this->catalog_languages[DEFAULT_LANGUAGE];
  }
}

function get_browser_language() {
  $this->browser_languages = explode(',', getenv('HTTP_ACCEPT_LANGUAGE'));

  for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) {
	reset($this->languages);
	while (list($key, $value) = each($this->languages)) {
	  if (eregi('^(' . $value . ')(;q=[0-9]\\.[0-9])?$', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
		$this->language = $this->catalog_languages[$key];
		break 2;
	  }
	}
  }
}
 }
?>

 

i belive i have to change this

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

 

to this

 

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

 

which i have tried but i then get a

Parse Error: syntax error, unexpected '^'in C:\xampp\htdocs\catalog\includes\classes\language.php on line 87

 

 

The above issue has been sorted i still am trying to resolve the bottom issues

 

I also have the problem in

catalog/admin/configuration

 

Deprecated: Function ereg() is deprecated in C:\xampp\htdocs\catalog\admin\configuration.php on line 80

Deprecated: Function ereg() is deprecated in C:\xampp\htdocs\catalog\admin\configuration.php on line 80

 

Deprecated: Function ereg() is deprecated in C:\xampp\htdocs\catalog\admin\modules.php on line 237

Deprecated: Function ereg() is deprecated in C:\xampp\htdocs\catalog\admin\modules.php on line 237

 

 

Hopefully someone would be kind enough to point me in the right direction to sort out this mess.

Thanks

 

teresa

Link to comment
Share on other sites

  • 4 weeks later...

Its due to the version of php on your server, two ways to fix:

 

In includes/application_top.php and admin/includes/application_top.php

 

find:

 

 //set the level of error reporting
 error_reporting(E_ALL & ~E_NOTICE);

 

replace with:

 

//set the level of error reporting
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

 

or there is this thread on how to replace the deprecated regex extension functions.

http://www.oscommerce.com/forums/index.php?showtopic=341737

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Thanks for the help. It works. Cheers.

 

 

Its due to the version of php on your server, two ways to fix:

 

In includes/application_top.php and admin/includes/application_top.php

 

find:

 

 //set the level of error reporting
 error_reporting(E_ALL & ~E_NOTICE);

 

replace with:

 

//set the level of error reporting
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

 

or there is this thread on how to replace the deprecated regex extension functions.

http://www.oscommerce.com/forums/index.php?showtopic=341737

Link to comment
Share on other sites

  • 1 month later...
  • 10 months later...

In the OP, I see that the author changed ' (single quotation marks) to an acute accent mark (the reverse of `, sorry, I have no way to type it in). DON'T DO THAT!!!! PHP only accepts ' and " to mark strings. That's why they got the Parse error.

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

i belive i have to change this

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

 

to this

 

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

Two things to consider.

 

First - The mentioned changes to the file application_top.php WON'T FIX the issue.

It HIDES only.

 

Second - Your code works, but have one mistake.

 

Code uses apostrophes -> '

Instead of circumflex accent -> `

 

Try this:

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

E-commerce?

No external links please.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...