Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Deprecated after updating to PHP 5.3


Guest

Recommended Posts

I changed hosts which updated me to PHP 5.3 from 5.2

 

I got a million Deprecated errors and I manually installed this addon http://www.oscommerc...tributions,7394

 

It fixed almost everything expect for a few errors.

I cannot checkout+add an item to my cart.

 

This is the error I get during checkout

 

Deprecated: Function split() is deprecated in /home/XXXX/public_html/XXXX.com/includes/functions/general.php on line 1061

Warning: Cannot modify header information - headers already sent by (output started at /home/XXXX/public_html/XXXXX/includes/functions/general.php:1061) in /home/XXXXX/public_html/XXXXXX/includes/functions/general.php on line 38

 

Any ideas what is causing this error?

 

 

Thanks

Link to comment
Share on other sites

Either the mod's author missed one, or you have a mod added to your installation. Either way,

split('pattern', $string)

needs to be changed to

preg_split('/pattern/', $string)

Note that if the pattern contains / already, you could use another character such as #, or you can escape the /'s inside the pattern with \ (\/).

Link to comment
Share on other sites

Ok I think I figured out what the issue was, I incorrectly edited my general.php file, I simply uploaded theres.

I am only finding 1 more Error.

When browsing my products this will show up at the top of the product list ONLY on page 2+

 

Deprecated: Function ereg() is deprecated in /home/XXXX/public_html/XXXXX/index.php on line 291

 

any idea what it is?

Link to comment
Share on other sites

Go to http://php.net and look up the function "ereg". It will point you to a recommended replacement, "preg_match". The arguments to the call are the same, except that you have to put / / or # # around the pattern string (see my previous posting). Now you will know the principles and will be able to fix all these things yourself.

Link to comment
Share on other sites

Go to http://php.net and look up the function "ereg". It will point you to a recommended replacement, "preg_match". The arguments to the call are the same, except that you have to put / / or # # around the pattern string (see my previous posting). Now you will know the principles and will be able to fix all these things yourself.

 

Thank you so much for leading me in the right direction, I found information about converting them at these two links:

http://devthought.com/2009/06/09/fix-ereg-is-deprecated-errors-in-php-53/

.http://www.php.net/manual/en/reference.pcre.pattern.posix.php

 

 

Thanks Again!

Link to comment
Share on other sites

Well nvm, I have been able to fix all of them but this one:

 

in banner manager(admin)

 

Parse error: syntax error, unexpected '{' in /home/XXXXX/public_html/XXXXXXX/XXXXXXXX/includes/classes/phplot.php on line 782

 

line 782 in that file if (eregi($asked, $accepted)) {

 

Ive tried to do all of the following and still get errors

if (preg_match($asked, $accepted)) {

if (preg_match('/$asked, $accepted/'i)) {

if (preg_match('/$asked/', $accepted)) {

if (preg_match('/$asked/i', $accepted)) {

if (preg_match('/$asked, $accepted/i')) {

if (preg_match('/$asked, $accepted)/') {

if (preg_match('/$asked, $accepted))/' {

if (preg_match('/$asked, $accepted))/i' {

if ( preg_match('{' . $asked . '}i', $accepted) ) {

if (preg_match('/' . $asked .'/i', $accepted)) {

 

Am I doing something fundamentaly wrong or looking in the wrong place?

Link to comment
Share on other sites

Yes, you're doing something fundamentally wrong. Your pattern is a variable $asked, and a variable is not substituted within a single quoted ' string. You need to use double quotes (quotation marks) " .

if (preg_match("/$asked/i", $accepted)) {

 

Note: if $asked might ever contain a slash / , this will break. Either use some other character (e.g., # or &) to delimit the pattern, or process $asked to change / to \/ (that's backslash-slash, not a Vee).

 

I suggest that you learn some basic PHP before attempting to edit code.

Link to comment
Share on other sites

so many modules and topics are available on this website, simply search for it and you will find it. As I personally wrote the topic about and show the exactly lines which need to corrected.

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Link to comment
Share on other sites

Thanks for the replies.

I have searched this exact phrase on google and found where they offered a replacement code. It still didn't work for me, that's why I'm asking.

Link to comment
Share on other sites

PCI compliance pushes us towards an upgrade to PHP 5.3.8. Obviously, none of the above errors could have been fixed at the time of the final osC 2.3.1 release. Therefore, I am wondering whether there is a tool that brings a clean osC 2.3.1 installation up to date with PHP 5.3.8 to avoid all the suggested "handwork".

Link to comment
Share on other sites

I don't know if you solved your problems, but I had the same issues and posted everything I did here: http://www.oscommerce.com/forums/topic/381320-since-were-updating-deprecated-session-and-ereg-solutions/

 

I upgraded to PHP 5.3.8 and that will create problems for you since it looks like you're using PHP4.

Anyone can buy a camera... it's what you do with it that counts!

Sticky Pod

www.stickypod.com

Link to comment
Share on other sites

Bill,

Can you paste in the entire phplot.php code thanks. It may make it easier to determine the source of the error.

 

Also when you tried those variations, did you get the same error or did the error change?

- Stop Oscommerce hacks dead in their tracks with osC_Sec (see discussion here)
- Another discussion about infected files ::here::
- A discussion on file permissions ::here::
- Site hacked? Should you upgrade or not, some thoughts ::here::
- Fix the admin login bypass exploit here
- Pareto Security: New security addon I am developing, a remake of osC_Sec in PHP 5 with a number of fixes
- BTC:1LHiMXedmtyq4wcYLedk9i9gkk8A8Hk7qX

Link to comment
Share on other sites

From osC 2.2RC1

 function SetPlotType($which_pt) {
 $accepted = "bars,lines,linepoints,area,points,pie,thinbarline";
 $asked = trim($which_pt);
 if (eregi($asked, $accepted)) {
  $this->plot_type = $which_pt;
  return true;
 } else {
  $this->DrawError('$which_pt not an acceptable plot type');
  return false;
 }
}

From osC 2.3.1

 
function SetPlotType($which_pt) {
 $accepted = "bars,lines,linepoints,area,points,pie,thinbarline";
 $asked = trim($which_pt);
 if (preg_match('/' . $asked .'/i', $accepted)) {
  $this->plot_type = $which_pt;
  return true;
 } else {
  $this->DrawError('$which_pt not an acceptable plot type');
  return false;
 }
}

- Stop Oscommerce hacks dead in their tracks with osC_Sec (see discussion here)
- Another discussion about infected files ::here::
- A discussion on file permissions ::here::
- Site hacked? Should you upgrade or not, some thoughts ::here::
- Fix the admin login bypass exploit here
- Pareto Security: New security addon I am developing, a remake of osC_Sec in PHP 5 with a number of fixes
- BTC:1LHiMXedmtyq4wcYLedk9i9gkk8A8Hk7qX

Link to comment
Share on other sites

  if (eregi($asked, $accepted)) {

and

  if (preg_match('/' . $asked .'/i', $accepted)) {

and for that mattter,

 

  if (preg_match("/$asked/i", $accepted)) {

are identical in function (provided that $asked does not contain slashes / ).

All of these will work in PHP 4 and 5. As of PHP 5.3, you will get lots of annoying warning messages with the eregi() version. At some point in the future, the eregi() will stop working.

Link to comment
Share on other sites

  if (eregi($asked, $accepted)) {

and

  if (preg_match('/' . $asked .'/i', $accepted)) {

and for that mattter,

 

  if (preg_match("/$asked/i", $accepted)) {

are identical in function (provided that $asked does not contain slashes / ).

All of these will work in PHP 4 and 5. As of PHP 5.3, you will get lots of annoying warning messages with the eregi() version.

Link to comment
Share on other sites

Posted 08 November 2011, 21:49

Either the mod's author missed one, or you have a mod added to your installation. Either way,

 

split('pattern', $string)

needs to be changed to

 

preg_split('/pattern/', $string)

Note that if the pattern contains / already, you could use another character such as #, or you can escape the /'s inside the pattern with \ (\/).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...