Jump to content
OldPete

Flash from the past... but the "fixes" aren't fixing it for me... Function eregi() is deprecated...

Recommended Posts

I made the change tot he language file... but I still get all the errors... I'm wondering if I'm missing something simple?

The domain is cashcandle.com

I know it's old... but anyone able to give guidance would be very appreciated.


Thanks!

 

	 for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) {
        reset($this->languages);
        while (list($key, $value) = each($this->languages)) {
          //if (eregi('^(' . $value . ')(;q=[0-9]\\.[0-9])?$', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
             if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$^/i', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
 
            $this->language = $this->catalog_languages[$key];
            break 2;
	

Share this post


Link to post
Share on other sites

For example, here's one of the errors:

Deprecated: Function eregi() is deprecated in /home2/cash/public_html/includes/classes/seo.class.php on line 1823

 

1823 from the file is:

:    eregi("(".implode('|', $pattern).")", $this->uri) 

 

It appears that this occurs for multiple files when you visit the site.

Share this post


Link to post
Share on other sites
8 minutes ago, OldPete said:

I made the change tot he language file... but I still get all the errors... I'm wondering if I'm missing something simple?

The domain is cashcandle.com

I know it's old... but anyone able to give guidance would be very appreciated.


Thanks!

 

 


	 for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) {
        reset($this->languages);
        while (list($key, $value) = each($this->languages)) {
          //if (eregi('^(' . $value . ')(;q=[0-9]\\.[0-9])?$', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
             if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$^/i', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
 
            $this->language = $this->catalog_languages[$key];
            break 2;
	

 

Which file is this from?

Share this post


Link to post
Share on other sites

eregi function is deprecated and needs to be replaced with preg_match.

This is not your biggest problem.

the deprecated each function also needs to be replaced everywhere throughout osCommerce, and this will take you a while. See the links in my sig, as a guide to fixing those.

 

Share this post


Link to post
Share on other sites

I see two links in your sig, W3... and Vanilla...

I apologize, but I don't see a guide on code changes, etc. for this problem.

Thanks,
Pete

 

Share this post


Link to post
Share on other sites
24 minutes ago, OldPete said:

I see two links in your sig, W3... and Vanilla...

I apologize, but I don't see a guide on code changes, etc. for this problem.

Thanks,
Pete

 

Those 2 links point to updated versions of osCommerce, that will run on php8. So you reference the code there against the errors you have. In case you're not aware, updating the code of the osCommerce version you are still running is weeks of work.

For the errors in seo.class.php (ultimate urls) you can reference the errors against a later version of the addon, although the last few versions may not be adaptable to what you have.

I recommend you update your SEO URLs with this:

https://apps.oscommerce.com/A9ikD&amp;ultimate-seo-urls-5-by-fwr-media

There are instructions in the package to upgrade from a version like yours, and you will keep your old URLs.

Share this post


Link to post
Share on other sites

Thanks for the reply.  I think I found a thread that explains things.  With all due respect, it appears you are trying to sell me something.  Forgive me if I am wrong.

Share this post


Link to post
Share on other sites
4 hours ago, OldPete said:

Deprecated: Function eregi() is deprecated in /home2/cash/public_html/includes/classes/seo.class.php on line 1823

I suggest that you first go into admin->Configuration->SEO URLs and turn that addon off. Then reload your shop to make sure it works. If it works, then the only problem is in the Ultimate SEO addon and you can update that to a later version by just uploading a file. If you still get the failures then spending time on the addon won't get you anywhere. You will need to fix those problems first. Normally when a shop has an ereg function in it, there will be many more scattered throughout the code and they will all need to be fixed.

Share this post


Link to post
Share on other sites
3 minutes ago, Jack_mcs said:

I suggest that you first go into admin->Configuration->SEO URLs and turn that addon off. Then reload your shop to make sure it works. If it works, then the only problem is in the Ultimate SEO addon and you can update that to a later version by just uploading a file. If you still get the failures then spending time on the addon won't get you anywhere. You will need to fix those problems first. Normally when a shop has an ereg function in it, there will be many more scattered throughout the code and they will all need to be fixed.

The OP's given his URL and if you go there, there are errors throughout the shop, so his problem is not limited to SEO URLs.

Share this post


Link to post
Share on other sites

I ended up trying to upgrade the SEO mod, which didn't go well...

So, I'm in the process of restoring the site.

 

What we learned is that the host went to php 7.4 and that created some issues. I *should* have the host down to 5.4... hopefully that solves the issue.

 

In the end, I'd like to have it up and running properly, but if this gets it back up, great.

Share this post


Link to post
Share on other sites
31 minutes ago, OldPete said:

I *should* have the host down to 5.4... hopefully that solves the issue.

You can ask them to but it is unlikely they will, assuming this is a shared server.  The popular control panels have removed older php versions and many hosts don't have the setup to add them back in, or won't even if they do. Perhaps yours is different. 

Share this post


Link to post
Share on other sites

@OldPete You did not mention which version of osC your site is running. However, I will guess that it is an older version.

** ALL ** of the older 'official' versions of osC are not coded to run under newer versions of PHP, and WILL CRASH as hosts upgrade the version of PHP they are running!

Your options are:

1) Get your host to down-grade you to an earlier version of PHP (v5.x). This is ONLY A TEMPORARY FIX, and many/most hosts are discontinuing support for older versions of PHP.

2) Look at the code in the examples that Hotclutch linked to, and apply ALL of the changes in his code to your site. No, he is not trying to SELL you anything. Be aware that there is a LOT of updates needed to get the old osC code to run under newer versions of PHP. If you don't feel comfortable doing this yourself, you can hire someone to do it for your (again, Hotclutch is NOT trying to sell you something).

3) Look into one of the newer 'unofficial' versions and/or forks of osC. Hotclutch linked to two versions. There are others. Many of these will offer improvements and upgrades from your old version (such as a responsive display, that adjusts the page layout depending on the screen size of your customers. This is crucial in today's age where most people are using mobile devices).

None of these are an in-place upgrade. You would need to install the new code in a new directory, migrate your data over (customers, products, sales history, etc), and apply any mods or add-ons you had in your old shop (make sure they are compatible with whatever new shop code you use!). If you are not comfortable doing this yourself, you can hire someone to do this for you (again, Hotclutch is NOT trying to sell you something).

4) The original developer of osC has sold the name and code to a new party. This new party has announced that they will be releasing a new 'official' version of osC (v4), and will offer a migration path from older versions. However, this new version is late, and the new owners have not been active in keeping us informed as to when it will be available.

I am sure that there are other options (like moving to a different shopping cart program), but this will give you an idea of what is needed for you to move forward.

HTH

Malcolm

Share this post


Link to post
Share on other sites

Thought you'd find this funny... for anyone who stumbles on my post.

We run a different site... and we had a similar issue.

In that case all I had to do was change:

	  function tep_sanitize_string($string) {
 //   $string = preg_replace(' +', ' ', trim($string));
 $string = str_replace(' +', ' ', trim($string));
	
    return preg_replace("/[<>]/", '_', $string);
  }
	

 

The "str" bit was the key.

Share this post


Link to post
Share on other sites
26 minutes ago, OldPete said:

The "str" bit was the key.

Yes, you can use str_replace instead of preg_replace in some situations. But, as mentioned, there is usually other places in the code that need auch changes and those may not be so simple. 

Share this post


Link to post
Share on other sites

Another note... Ha! I just realized, my htaccess has this:

AddType application/x-httpd-php52cgi .php
Action application/x-httpd-php52cgi /cgi-sys/php52.cgi

Not sure how long that'll work.  (This is on that other site, not the one I started this thread with.)

Share this post


Link to post
Share on other sites

@OldPete

4 minutes ago, OldPete said:

Another note... Ha! I just realized, my htaccess has this:

AddType application/x-httpd-php52cgi .php
Action application/x-httpd-php52cgi /cgi-sys/php52.cgi

Not sure how long that'll work.  (This is on that other site, not the one I started this thread with.)

I have my shops all on the same hose (and presumably, the same server). One shop is running PHP 5.4.45, another PHP 5.6.40, and another 7.4.23. And the down-rev PHP shops all have a similar line in the .htaccess file.

M

Share this post


Link to post
Share on other sites
6 minutes ago, ArtcoInc said:

@OldPete

I have my shops all on the same hose (and presumably, the same server). One shop is running PHP 5.4.45, another PHP 5.6.40, and another 7.4.23. And the down-rev PHP shops all have a similar line in the .htaccess file.

M

 

What are your thoughts on that? I'm assuming that means that for as long as the v5.x is an option, those sites will continue to be stable?

 

The funny part is that the "other" site became unstable -- and had that line in it, yet I made the "st" change and it was better...

 

Definitely above my level of intelligence. LOL.

Share this post


Link to post
Share on other sites

When my shops 'crashed', and I phoned support to ask them to roll back PHP, they could not install the same version of PHP on the crashed sites (no idea why! Same server .... <shrug>).

The .htaccess file for one shop loads PHP v5.4, and the .htaccess file for the other loads PHP v5.6. Hence, why one shop is on v5.4.45, and the other on v5.6.40.

My thoughts? It's working for now (fingers crossed), and I *really* need to upgrade both shops 'real soon now'!

M

Share this post


Link to post
Share on other sites
2 minutes ago, ArtcoInc said:

When my shops 'crashed', and I phoned support to ask them to roll back PHP, they could not install the same version of PHP on the crashed sites (no idea why! Same server .... <shrug>).

The .htaccess file for one shop loads PHP v5.4, and the .htaccess file for the other loads PHP v5.6. Hence, why one shop is on v5.4.45, and the other on v5.6.40.

My thoughts? It's working for now (fingers crossed), and I *really* need to upgrade both shops 'real soon now'!

M

 

You sound exactly like me. LOL. 

Share this post


Link to post
Share on other sites
Posted (edited)
Quote

... they will be releasing a new 'official' version of osC (v4), and will offer a migration path from older versions.

Hey Malcolm,

That part about updating older sites to the new version is not likely to apply to osC sites older than osCv4. Let me give this some clarity. I think there is a misunderstanding of this so called “promise” ..in that, the new version will be upgradeable to versions that follow it, and not that you will be able to take an MS2.2 shop and update it to osCv4.

In theory, you could write a script for each and every deprecated feature from PHP5.2 to PHP8.0. One that seeks out each instance of such code and then replaces it with one that works on the latest PHP version. However, then you will run into issues such as the one Jack mentioned earlier in this thread, where you have more than one option for replacing a function and you have to read the code to understand which option you have to use.

This would be a major coding project for the new ownership, and one that carries a HUGE risk of liability for them (even with a signed waiver),.. for live shops that end up crashing or having modules & features not working properly.

My understanding of Vadym’s comment is that osCv4 will be upgradeable to all newer versions released thereafter. This makes more sense to me, in that this will resemble the WordPress model, where all core files are updated to the latest PHP version via a click of a button. Something osCommerce should have done from the very start! If this structure was implemented with osC early on, we would not be seeing threads like this one where people are running legacy PHP shops and are left with their pants down when the hosting company makes the decision to no longer support that PHP version.

And on a personal note, ..what are you waiting for? You have a 5.4 and a 5.6 shop, both of which could be disabled via a hosting company’s PHP update any day now. Business disruptions and down time hurt your wallet as well as your brand. My hosting company is telling me that PHP7.3 is now considered “obsolete.”

 

Edited by Demitry

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Share this post


Link to post
Share on other sites

^^ I am surprised that people still have hope for a V4. I think the new owners have come to the conclusion that it is not financially feasible to release their code open source, if that was ever their intention.

If an upgrade script is to be made available it will only take into consideration the code from the last official version. People's addons and outdated code won't be taken into consideration.

People who are in this position should heed this warning: The difference between php7 and php8 is that 7 tolerates errors and warnings, whereas php8 makes them fatal errors. So if you have a shop that earns you revenue that you depend on, now is the time to do something about it.

 

Share this post


Link to post
Share on other sites

@Hotclutch @Demitry Thank you for your input. This gives the op more information with which to base his/her/their upgrade choice.

I was not promoting waiting to upgrade to osC v4, merely tossing that out as an option (although not one I would choose). When Vadym announced the new ownership, he *did* say ..
 

Quote

 

osCommerce v4 is about:

    business growth for shop owners
    new revenue streams for designers and developers
    modern, powerful, and secure Ecommerce platform for small, medium, and large B2C and B2B businesses
    API-based integration with 3rd parties
    osCommerce that is easy to support, maintain, and upgrade
    mobile and SEO friendly platform
    smooth migration from osCommerce 2.x and other Ecommerce solutions

 

But, since he has not been here for some time, and is late in releasing v4, we can't see how smooth that migration might be.

There is an osC fork (that we aren't supposed to talk about here) that does have a migration tool. I have used it, and while it is not perfect,  it does work. But any migration will have issues. The way add-ons were used in older versions of osC WILL create migration issues.

For those of us here that are trying to support other osC users, there has to be a balance between offering encouraging support, and promoting "gloom and doom" by saying osC is dead (that's another discussion), that it is not fixable (Hotclutch has shown that it IS fixable), and that one needs to jump ship.

I wish the op luck in fixing their shop. Now, I need to get off of my lazy butt and fix mine, but that's another story.

Malcolm

Share this post


Link to post
Share on other sites
Posted (edited)

@ArtcoInc

Quote

smooth migration from osCommerce 2.x and other Ecommerce solutions

I didn’t see that post from Vadym. I saw another one a while back and am now not sure if it was from him or second-hand. So, I was wrong in my understanding of that 2.x migration to osCv4, and you are right. Though having read this, I am now even more skeptical of the osCv4 rollout.

I assume that your “Doom & Gloom” comment was directed at me. If so, I disagree with your perception of such comments. I’m a realist, ..just being realistic!

1. The last official release of this software was over 4 years old and is not compatible with today’s PHP version.  

2. The software is not made to be upgradeable to newer osC versions and is not easily upgradeable to new PHP versions.

3. osC is a bare-bones set of core files that is completely dependent on addons for basic features to make it a working shop.

4. The addons site is in disarray with old and poorly coded addons most of which have not been updated in years and the majority of which are written by amateur programmers.

5. The main source of osCommerce technical support we now have is,… (drum-roll…….) => Jack! And I am very grateful for his continued commitment, availability, and help.

Most of the other senior developers/techs have either jumped ship or are not wasting any more of their time on osC support. Good for them! I am grateful to them for all the time, effort, and expertise they donated to help the rest of us.

6. osC went belly-up a decade ago and there are currently around 30 people following Vadym’s “new osCommerce V4” thread who are interested in the V4 release. Numbers don’t lie! https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

7. You basically have to be a programmer or know a programmer to set-up and manage an osC site. This software is not for the non-technical shop owner, which is pretty much most everyone.

8. The new osC ownership missed their own deadline for the release of the new version, which was supposed to be available this past summer of 2021.

9. That last D-bag that pretended to manage osCommerce for years, basically wiped his ass with it. And, the new osC ownership have been MIA for months.

Considering all of these issues, how can you tell newbies and existing shop owners (whose old osC software is failing them), that they should stick with osCommerce? Yeah!, I tell them the truth, ..that they should go find another cart software. Why? Because it’s immoral and unethical not to. That’s not “Doom & Gloom,” ..that’s being real about the software’s current state and any future projection (seeing how the new ownership has thus far handled the osCv4 rollout). That’s me saving them a ton of time, money, and aggravation.

I do believe that Vadym and his team will eventually release osCv4, which will breathe some life into this software. Though again, being realistic, ..it is highly unlikely that this new version will somehow propel osCommerce to compete with some of the big names of eComm software in the industry (or even some of the smaller ones).

 

Quote

...that it is not fixable (Hotclutch has shown that it IS fixable)


Ashley is just having some fun and trying to help those that still think osC is a viable eComm solution. Though your comment only proves my point. A non-technical person cannot do what Ashley (as well as Ruden) did, and that’s just patching an old software to the latest PHP version (plus a few minor tweaks). There is still the process of loading all the necessary addons, bringing them up to date, and testing them. This doesn’t even include customization.

That’s like saying, “look how easy it is for that ballerina to dance on stage,” ...but try explaining that to the cops arresting you for dancing in a pink tutu on Time Square.

So, that’s fairly easy stuff for someone who knows osCommerce directory, file, and code structure and is at least semi-technical (though extremely time consuming!). Not so much for the non-technical newbie or a shop owner who is still running an MS2.2 candle shop on PHP5.3.

 

 

Edited by Demitry

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×