Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Each And Long Arrays In Php5 (possible Bug)


BKnapik

Recommended Posts

Posted

Hello all,

 

I just recently upgraded my server to php5.2.3 and I noticed that when I would go to configure modules and save their configuration settings, the information would not be updated in the database. After a little bit of debugging, I found that the following line was the problem in catalog/admin/modules.php.

 

while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {

 

Supposedly, that line is never true, and the while loop would never execute. When I changed the line to

 

while (list($key, $value) = each($_POST['configuration'])) {

 

 

The code worked perfectly. register_long_arrays is on in the php.ini file and everything else appears to be working smoothly. I have quite a few clients I need to make this change to.

 

Has anyone seen this before and could explain why this code breaks with register_long_arrays?

Posted

These style $HTTP_*_VARS are being depreciated.

 

http://www.php.net/manual/en/ini.core.php#...ter-long-arrays

 

 

You can look at catalog/includes/functions/compatibility.php where it creates some empty arrays.

 

// $HTTP_xxx_VARS are always set on php4
 if (!is_array($HTTP_GET_VARS)) $HTTP_GET_VARS = array();
 if (!is_array($HTTP_POST_VARS)) $HTTP_POST_VARS = array();
 if (!is_array($HTTP_COOKIE_VARS)) $HTTP_COOKIE_VARS = array();

 

Try something like this instead

 

 if (!is_array($HTTP_GET_VARS)) $HTTP_GET_VARS = $_GET;
if (!is_array($HTTP_POST_VARS)) $HTTP_POST_VARS = $_POST;
if (!is_array($HTTP_COOKIE_VARS)) $HTTP_COOKIE_VARS = $_COOKIE;

if (!is_array($HTTP_SERVER_VARS)) $HTTP_SERVER_VARS = $_SERVER;

 

Also in admin

Posted

Well actually if I add print_r($HTTP_POST_VARS['configuration']); to the code it prints the array correctly. so the values are there and have the proper values.

  • 4 weeks later...
Posted
Hello all,

 

I just recently upgraded my server to php5.2.3 ...

I upgraded my server as well and now OSCommerce does not function. Any product clicked on says "no such product" and the admin login is blank.

 

Did you have any such problems? If so how did you fix them?

Archived

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

×
×
  • Create New...