views:

37

answers:

3

Hi, I m using PHP5 with Xampp server

After successful installation of OSCommerce2.2 there are some warnings appear as below

Deprecated: Function eregi() is deprecated in D:\xampp\htdocs\oscomm\catalog\includes\classes\language.php

How ever this was never occur before ..

+3  A: 

This means the developers of osCommerce should stop using ereg*() functions whenever they can as they're going to be phased out in future versions of PHP. You may want to file a ticket or something to let them know about this.

In the meantime, to turn those deprecated notices off, set error_reporting() to exclude E_DEPRECATED either in one of osCommerce's config files or in your php.ini if you can access it. This is the best you can do, because if you try to replace all those ereg*() calls with preg_*() calls in osCommerce's source code, an upgrade of osCommerce will just undo your changes and trigger the deprecation notices again.

BoltClock
Muhammad Sajid
BoltClock
A: 

The function eregi is deprecated as of PHP 5.3. From the manual:

This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.

You should use preg_match with switch i as follows:

$string = 'XYZz';
if (eregi('z{2,}$', $string)) {
    echo "'$string' contains atleast 2 z|Z's at the end.";
}
if (preg_match('/z{2,}$/i', $string)) {
    echo "'$string' contains atleast 2 z|Z's at the end.";
}
codaddict
A: 

Solution is simple, eregi is no more supported in PHP5. Replace all the eregi occurences to preg_match and add a /i modifier to match in case insensitive mode.

erenon
I would not recommend to edit the source code of a third party application.
Felix Kling
The syntax will be slightly different so it may not just be a matter of replacing the function names. Plus, I'm not sure how sustainable doing this would be since an upgrade of osCommerce will effectively undo those changes if they still haven't done the change themselves.
BoltClock