Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

error with php 4.3.1 and register_globals = on


jharkes

Recommended Posts

My shop works perfectly with PHP 4.1.2, but I moved it to a server with PHP 4.3.1 (with register_globals turned on) and now I recieve an fatal error in the email class.

 

my error is:

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/jeroen/shop/includes/classes/email.php on line 71

Warning: Variable passed to each() is not an array or object in /home/jeroen/shop/includes/classes/email.php on line 72

Fatal error: Call to a member function on a non-object in /home/jeroen/shop/includes/functions/general.php on line 1015
Query was empty - Query was empty

Query was empty

[TEP STOP]


Warning: Unknown(): A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0

 

arrays passed with the email creation don't get recognized in the class-creation funtion, but specific variables can be read. for example:

 

var_dump($headers);     // returns NULL
var_dump($headers[0]);  // returns the string

echo gettype($headers); //doesn't return anything
echo gettype($headers[0]); //returns string

 

 

Can anyone help me?

 

Jeroen

 

(PS. The acount does get created in the database)

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hi.

I got the same problem on Unix platform but not on a Windows one.

I think this is really a (strange!) bug in oscommerce ms2.2

I found a workaround :

This only works if you don't care about "state" customer address information.

The idea is in eliminating the "state" customer address information anywhere in oscommerce.

 

In the file create_account.php, find :

 

    if (ACCOUNT_STATE == 'true') {
     $zone_id = 0;
     $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
     $check = tep_db_fetch_array($check_query);
     $entry_state_has_zones = ($check['total'] > 0);
     if ($entry_state_has_zones == true) {
       $zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
       if (tep_db_num_rows($zone_query) == 1) {
         $zone = tep_db_fetch_array($zone_query);
         $zone_id = $zone['zone_id'];
       } else {
         $error = true;

         $messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
       }
     } else {
       if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
         $error = true;

         $messageStack->add('create_account', ENTRY_STATE_ERROR);
       }
     }
   }

 

and replace with :

 

    if (ACCOUNT_STATE == 'true') {
     $zone_id = 0;
     $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
     $check = tep_db_fetch_array($check_query);
     $entry_state_has_zones = ($check['total'] > 0);
     /* if ($entry_state_has_zones == true) {
       $zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
       if (tep_db_num_rows($zone_query) == 1) {
         $zone = tep_db_fetch_array($zone_query);
         $zone_id = $zone['zone_id'];
       } else {
         $error = true;

         $messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
       }
     } else {
       if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
         $error = true;

         $messageStack->add('create_account', ENTRY_STATE_ERROR);
       }
     }*/
   }

 

In fact you have to comment a portion of code.

You have also to modifiy 8 other files to completely eliminate "state" address information.

 

In each of theses files :

 

address_book_process.php

checkout_payment_address.php

checkout_shipping_address.php

admin/customers.php

includes/form_check.js.php

includes/modules/address_book_details.php

includes/modules/checkout_new_address.php

 

Enclose each

if (ACCOUNT_STATE == 'true') {.....
....
...
}

 

with /* */

 

(or simply delete the blocks).

 

About half an hour work... and it works ! :) :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...