Deprecated: Function eregi() is deprecated – CubeCart

Are you getting messages like these in your CubeCart site?

Deprecated: Function eregi() is deprecated in /home/…/public_html/includes/sslSwitch.inc.php on line 30

Deprecated: Function eregi() is deprecated in /home/…/public_html/includes/session.inc.php on line 30

Deprecated: Function ereg() is deprecated in /home/…/public_html/includes/functions.inc.php on line 119

Warning: Cannot modify header information – headers already sent by (output started at /home/…/public_html/includes/sslSwitch.inc.php:30) in /home/…/public_html/includes/session.inc.php on line 95

Deprecated: Function eregi() is deprecated in /home/…/public_html/includes/currencyVars.inc.php on line 30

Deprecated: Function eregi() is deprecated in /home/…/public_html/includes/content/index.inc.php on line 30

Deprecated: Function eregi_replace() is deprecated in /home/…/public_html/includes/functions.inc.php on line 64

What does this mean?

To put it simply, it means that your web hosting company has updated php, one of the programming languages your CubeCart site was built with, and the CubeCart programs can no longer cope with it.

\"deprecated

The technical explanation

Here\’s a more technical explanation, in case you want to try to fix it yourself.  Let\’s assume you have at least a basic knowledge of php, and you know how to get access to the programming that makes up your site (via cPanel or ftp or similar), and that you have made a backup of your site before you start playing with the programming.

\”Deprecated\” means that a particular function of the language is no longer available.  In this case, the functions are ereg, eregi and eregi_replace.  If you click on those links, you can find out more about what each function used to do.  But basically, ereg and similar functions would look for a sequence of characters within a string variable, and (with the _replace functions) optionally replace those characters with other characters.

These functions were very useful for manipulating strings, but were deprecated in version 5.3.0 of php, and removed in version 7.0.0.  What this means is (1) if your CubeCart site still uses this old code, your website will start giving error messages like these when your web hosting company updates to version 5.3.0 of php, and (2) when they update to 7.0.0, it won\’t work at all.  At the time of writing, in mid April 2019, php is up to version 7.1.28.  You can find out about the release history of php here, but basically 5.3.0 is pretty much dead after August 2014.  I wrote about that in early 2017, and WordFence wrote a great post last year, but there are still a lot of old CubeCart sites online.

So what can you do about it if you are a programmer?  Basically, the ereg expressions need to be replaced with an equivalent preg expression.  For example, the format for preg_match, which replaces ereg, is

preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] ) : int
 
As you can see, the format is rather different to that for ereg, which is:
 
ereg ( string $pattern , string $string [, array &$regs ] ) : int
 
so it is not always a straightforward job to do the replacement. 
 
By clicking on the links above for ereg etc, you will find links to the replacement functions.  As these functions appear several times in CubeCart, you will need to replace ALL of them, and test every part of your system.
 

But what if you are not a programmer?

 
Well apart from finding (and paying) a programmer to do all the programming for you, you could try finding a web hosting company that still uses php older than 5.6.  But that would probably be a web hosting company you would have other issues with, because they are not keeping their system up to date.  Or you could get a newer version of CubeCart and convert all your data to the new format, but that is also likely to require a certain amount of programming knowledge.
 
My recommendation would be to update to WordPress.  This is a system that is not so different to CubeCart that you would feel lost, but it is very well-supported.  Like the recent versions of CubeCart, it is available for free, but you will need to add a cart (I like WooCommerce) and other add-ons called \”plugins\” to make it more than the basic blogging system it was designed to be.  WordPress powers around a third of the websites on the internet, and so it is very well supported. 
 
Of course, if you move from CubeCart to WordPress, you will still have to hire a programmer to get all your data into the right format, but that will only need to be done once. 
 
At Gecko Gully, we offer a CubeCart to WordPress Conversion service.  So if you are having trouble with deprecated messages, or are just plain ready to start using the features and security that WordPress offers, get in touch.