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
error_reporting(0);

// 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)
error_reporting(E_ALL);

// Report all PHP errors
error_reporting(-1);

// 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.

Cheers

extradrmtech

Since 30 years I work on Database Architecture and data migration protocols. I am also a consultant in Web content management solutions and medias protecting solutions. I am 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. Besides my work, I like to work freelance only on some wordpress projects because it is relaxing and delightful CMS for me. When not working, I like to dance salsa and swing and to have fun with my little family.

You may also like...

Leave a Reply