Jump to content

eprecated: Function eregi() is deprecated in index_enc_ion.php


Guest Cora Internet Solutions

Recommended Posts

Guest Cora Internet Solutions

Hi,

The server where my site is hosted has just been upgraded from php 5.2 to 5.3 and the version of Cubecart is 4.1.1.

I've managed to clear up a few errors that are being reported but I have some within index_enc_ion.php that I can't seem to edit because it's encrypted (is that right?).

I'm getting errors like this:

Deprecated: Function eregi() is deprecated in /home/xxxx/public_html/index_enc_ion.php on line 30

I know that I need to replace the eregi() function but when I look at line 30 in index_enc_ion.php all I can see is lots of random characters.

How do I replace the eregi() function so that it works within index_enc_ion.php?

Thanks

Chris

Link to comment
Share on other sites

Hello Chris,

First, you realize 4.1.1 is rather old. But having mods installed is an unfortunate reason to not upgrade.

Second, the _enc_ files are not really encrypted. Thus, no key needed to decrypt. A closer term is encoded. But it is extraordinarily troublesome to decode. I prefer to think of them as pre-digested. That is, (if I understand correctly) PHP will read in script files and convert them to a crazily-optimized format called byte-code. Then the byte-code is what is actually executed. Zend and IonCube have created pre-digesters to secure against outside influences from meddling with the application code (and maybe to speed up the execution of some scripts, but I doubt that is the reason here). So, replacing the ereg() functions with their PHP5.3 equivalents would super-humanly difficult.

Luckily, these files have a human-readable preamble. So let's try this...

At the beginning of the second line, add this:


error_reporting(E_ALL & ~( E_NOTICE | E_DEPRECATED | E_USER_DEPRECATED ));

The question that remains is, if there is something like this at the end of the first line, //003ab, we might need to add 0x4a to this value.

You might also try downloading the latest version of CC4 and just simply rename the current _enc_ files to _oldenc_ and use the new ones.

Link to comment
Share on other sites

Guest Cora Internet Solutions

Hi,

Thanks for the excellent reply. I tried adding your code to the beginning of the second line but when I executed it I got the error "The file /home/xxxx/public_html/index_enc_ion.php is corrupted."

At the end of the first line I have //0035e so I added 0x4a to it and you code snippet to the beginning of line 2 but that just gave me an internal server error.

TBH the site needs a complete overhaul and I'm trying to convince the owner to do just that although I'm not holding my breath!

The latest version of CC4 is worth a go too so I'll try and get a copy.

Thanks again for your help :)

Link to comment
Share on other sites

Oh, stupid, stupid me! I had solved this for CC3 quite awhile ago. The fact that this popped up for CC4 threw me.

You can search the forums for 'deprecated' and get all you need to know. But basically, in the file ini.inc.php, find this near line 96:


error_reporting(E_ALL ^ E_NOTICE);


and change to 

error_reporting(E_ALL & ~( E_NOTICE | E_DEPRECATED | E_USER_DEPRECATED ));

======================

I hope by 'add' you took it to mean 35eH+4aH=3a8H, so the first line should be just:

<!--?php //003a8

Then, be sure there are no spaces between what you added and what was there on the second line originally.

Then, be sure you didn't accidentally change the UNIX line endings (x0A) to DOS line endings (x0A x0D) - although maybe that doesn't matter.

Then, be sure you didn't accidentally change the file encoding to a double-byte variant. (Use a programmer's editor, not Microsoft's Notepad.)

But then, this may all be moot because I don't know the purpose of that value anyway. It could be used by the ion loader, or it could just be a clue for the programmer using the pre-digester utility.

Or, let's see what the current version of _enc_ files will do.

Link to comment
Share on other sites

Thanks for the excellent reply. I tried adding your code to the beginning of the second line but when I executed it I got the error "The file /home/xxxx/public_html/index_enc_ion.php is corrupted."

Remember to upload in binary mode.

Version 4.1.1 is very old, upgrading to the latest release should be top priority. Don't forget to upgrade the skin as well.

Link to comment
Share on other sites

Guest Cora Internet Solutions

Thanks for the updates. Ok, here's what I did:

I added error_reporting(E_ALL & ~( E_NOTICE | E_DEPRECATED | E_USER_DEPRECATED )); to ini.inc.php and that's stopped the errors from being shown. The site is now displaying properly.

However, making the specified changes to the index_enc_ion.php file is preventing the site from displaying. Do I still need to make changes to the index_enc_ion.php file now that the site is displaying correctly?

I've spoken to the client about updating the site and I think they're going to do it so that's good but in the meantime I just need to ensure that it's working :)

Link to comment
Share on other sites

In CC3's case, there are two or three other files that do not use index.php to eventually get included, but rather, are called upon directly. In those cases, ereg() is not used, if I recall correctly.

In CC4's case, I have not verified if there are any files that do not use index.php as a starting place. If there are, then these files might not use ereg().

The vast majority of CC3's and this early version of CC4's instances used ereg() to determine if a php file called for by the browser was called directly (wrong) or included from some other file (correct). At some point in the CC4 versioning, a test against a declared constant was coded rather than testing for the name of the file used as a web address URL.

So, if a PHP file not meant to be called directly is called directly by a browser, the error reporting will not be adjusted and all the visitor will get is an error message about a deprecated function. If the visitor correctly calls for index.php, then the error reporting will get adjusted and all will be hunky-dory.

Restore the original _enc_ files from their _encold_ copies.

Since I don't have a copy of the 4.1.x package, I cannot determine where there are other cases of ereg() being used for purposes other than the "Can't do this!" test.

However, in CC4.3.8, there are no legitimate standalone files that still use ereg. These files (line number)...

adminsourceslogin.inc.php(144)

adminsourceshomeindex.inc.php(158)

adminsourcesproductsindex.inc.php(224)

adminsourcessettingsindex.inc.php(945)

classesgdgd.inc.php(44)

classessessioncc_session.php(197)

classessessioncc_session.php(200)

classessessioncc_session.php(206)

includesfunctions.inc.php(423)

includesfunctions.inc.php(991)

includescontentreg.inc.php(144)

includescontentreg.inc.php(184)

includescontentreg.inc.php(195)

...are eventually included by other files and, if called directly, will not function correctly anyway. So, no point to fixing them since the error reporting gets adjusted prior to these files getting included.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...