Latest News: (loading..)

Archived

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

xoxx

Deprecated after updating to PHP 5.3

17 posts in this topic

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

Share this post


Link to post
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 \ (\/).

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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".

Share this post


Link to post
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?

Share this post


Link to post
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;
 }
}

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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 \ (\/).

Share this post


Link to post
Share on other sites