Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

password reset error - Cannot redeclare do_magic_quotes_gpc()


jimlongo

Recommended Posts

2.3.3 / PHP5.3.18

 

When I try to reset the password, the email gets sent with the link.

When I click the link in the email I get a blank page.

 

This is the error I find in my logs

PHP Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in /blah/blah/public_html/blah/includes/functions/compatibility.php:18) in /home/blah/public_html/blah/includes/functions/compatibility.php on line 30

 

Thanks for any insight on this.

jim

Link to comment
Share on other sites

Did you upgrade from an older version of osCommerce? You've apparently copied all or part of do_magic_quotes_gpc() into that file twice. Look at the copy of includes/functions/compatibility.php that ships with osCommerce and use your comparison program to find where your copy is different.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I repeat this is the new file from a fresh download of 2.3.3

 

here is lines 18 to 30 from that file


 function do_magic_quotes_gpc(&$ar) {
   if (!is_array($ar)) return false;

   reset($ar);
   while (list($key, $value) = each($ar)) {
     if (is_array($ar[$key])) {
       do_magic_quotes_gpc($ar[$key]);
     } else {
       $ar[$key] = addslashes($value);
     }
   }
   reset($ar);
 }

Link to comment
Share on other sites

Check that you uploaded to the correct location. Also check that you are not uploading to the admin side for an error on the catalog side. I see nothing in that code that would cause the error you describe.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I've carefully replaced both of them. The catalog/includes/functions/compatibility.php and the catalog/admin/includes/functions/compatibility.php

Same thing.

 

Could it be something in my php configuration. I have

'--enable-magic-quotes'

in my configuration

 

magic_quotes_gpc On On

magic_quotes_runtime Off Off

magic_quotes_sybase Off Off

Link to comment
Share on other sites

Now this is getting annoying. That should not happen. Oh well, time for the sledgehammer. Try replacing the code you posted above with this:

 

 if( !function_exists( 'do_magic_quotes_gpc' ) ) {
function do_magic_quotes_gpc(&$ar) {
if (!is_array($ar)) return false;

reset($ar);
while (list($key, $value) = each($ar)) {
if (is_array($ar[$key])) {
do_magic_quotes_gpc($ar[$key]);
} else {
$ar[$key] = addslashes($value);
}
}
reset($ar);
}
}

 

That doesn't really fix the problem, but it should get rid of the error message.

 

Regards

JIm

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

It looks like this is one of those cases where PHP throws a completely bogus error message. That's going to be hard to fix. I would try turning off magic_quotes_gpc in the server settings. If that doesn't help, it's probably some other setting, with no idea of which one.

 

Regrds

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

some sort of progress . . .

 

error has changed to

PHP Fatal error:  Cannot redeclare tep_db_connect() (previously declared in /home/foo/public_html/register/includes/functions/database.php:13) in /home/foo/public_html/register/includes/functions/database.php on line 25

 

This file is also the new file from 2.3.3

Link to comment
Share on other sites

You could do the same trick of testing using function_exists(), but that's likely to result in a different error or another blank page. These error messages have nothing to do with the real problem. Unfortunately I have no idea what that problem is. Sorry, but I don't have any more good ideas.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

@@jimlongo

 

You can see the reason by this way:

 function do_magic_quotes_gpc(&$ar) {
   if (!is_array($ar)) return false;
print_r($ar);
   reset($ar);
   while (list($key, $value) = each($ar)) {
  if (is_array($ar[$key])) {
    do_magic_quotes_gpc($ar[$key]);
  } else {
    $ar[$key] = addslashes($value);
  }
   }
   reset($ar);
 }

 

I think the $ar has similar and not only one array.

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...