Remove Deprecated: Function eregi() error in oscommerce 2.2

The error_reporting() function sets the error_reporting directive at runtime. PHP has many levels of errors, using this function sets that level for the duration (runtime) of your script. If the optional level is not set, error_reporting() will just return the current error reporting level.

If you get deprecated function eregi from oscommerce 2.2 : then your host has upgraded to PHP 5.3 version or you have installed your oscommerce script under PHP 5.3.

To correct the problem temporary, please follow the below instructions :
find php code in top of includes/application_top.php file under catalog and admin folders :

error_reporting(E_ALL & ~E_NOTICE);

and then replace it with :

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

It is interesting to mention some other error_reporting() examples :

// Turn off all error reporting

// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);

// Report all PHP errors (see changelog)

// Report all PHP errors

// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);

Removing warning message deprecated will not correct the code obsolescence. It is advised to correct the ereg calls by following this post.



Since 20 years I work on Database Architecture and data migration protocols. I am also a consultant in Web content management solutions. I am an experienced web-developer with over 10 years developing PHP/MySQL, C#, VB.Net applications ranging from simple web sites to extensive web-based business applications. When not writing code, I like to dance salsa and swing and have fun with my little family.

You may also like...

Leave a Reply