Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

password reset error - Cannot redeclare do_magic_quotes_gpc()


jimlongo

Recommended Posts

Posted

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

Posted

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.

Posted

Thanks for your response Jim.

 

They looked the same, just to be safe I copied the new file from a fresh download of 2.3.3 to my server.

 

Still get the same result and same error.

Posted

The error message says you have the same code on lines 18 and 30. Check again; that error is rarely wrong.

 

Regards

Jim

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

Posted

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);
 }

Posted

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.

Posted

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

Posted

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.

Posted

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.

Posted

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

Posted

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.

Posted

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 >

Posted

@@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.

Posted

 

Thank you! I guess I wasn't careful enough when upgrading 2.3.1>2.3.2

I put the catalog/password_reset.php in the catalog/includes/languages/english/password_reset.php.

Archived

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

×
×
  • Create New...