Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problems with Arrays not being Arrays


Patabugen

Recommended Posts

Posted

When a user trys to create an account on my shop they get an error saying that the value passed to reset() is npt an array. It is doing this in the email class and the array it is looking for is $headers, which should be passed into the method as an array, or set as an empty array if not passed.

 

However, $headers = array('') dosen,t set $headers to be an array. I am currently looking in /included/functions/general.php at this code:

 

  function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
if (SEND_EMAILS != 'true') return false;
// Instantiate a new mail object
$message = new email(array('X-Mailer: osCommerce Mailer'));

 

If i change it to this:

  function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
if (SEND_EMAILS != 'true') return false;

// Instantiate a new mail object
$header_array = array('X-Mailer: osCommerce Mailer');
var_dump(is_array($header_array));
var_dump($header_array);
$message = new email($header_array);

 

the output is:

FALSE
NULL

 

However, in a test.php independant of oscommerce:

$array = array('hi there');
var_dump(is_array($array));

 

returns TRUE. So the problem dosen't apper to be with my installation of PHP. I am wondering whether oscommerce is, somehow, overriding the default behaviour of array() or... if anyone knows what the problem might be?

Posted

what version of php are you using? when i do

$x = array('test');
var_dump(is_array($x));

 

the output i get is:

bool(true)

 

since you get 'FALSE' instead of 'bool(false)' i'm guessing you're using an older version than 5.x? you might need to change the way you declare your array, like this:

$header_array = array();
$header_array[] = 'X-Mailer: osCommerce Mailer';

Archived

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

×
×
  • Create New...