PDA

View Full Version : Heavy problems with passed variable and member function



Markus
09-14-2003, 01:41 PM
Hello osCdox Forum,

I set up a new shop and now some things don't work. I really don't know why.
Maybe someone could help, this would be really great.

Thanks in advance
Markus

If a new customer registers then the following warnings appear:

error message:

Warning: reset() [function.reset]: Passed variable is not an array or object in /www/htdocs/karaoke/catalog/includes/classes/email.php on line 71

Warning: Variable passed to each() is not an array or object in /www/htdocs/karaoke/catalog/includes/classes/email.php on line 72

Fatal error: Call to a member function on a non-object in /www/htdocs/karaoke/catalog/includes/functions/general.php on line 971



So I tried toi find something about it, but didn't know what to do. Honestly I'm not that good in PHP and SQL.


email.php @ Lines 20 - 77:

class email {
var $html;
var $text;
var $output;
var $html_text;
var $html_images;
var $image_types;
var $build_params;
var $attachments;
var $headers;

function email($headers = '') {
if ($headers == '') $headers = array();

$this->html_images = array();
$this->headers = array();

if (EMAIL_LINEFEED == 'CRLF') {
$this->lf = "\r\n";
} else {
$this->lf = "\n";
}

/**
* If you want the auto load functionality
* to find other mime-image/file types, add the
* extension and content type here.
*/

$this->image_types = array('gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'bmp' => 'image/bmp',
'png' => 'image/png',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'swf' => 'application/x-shockwave-flash');

$this->build_params['html_encoding'] = 'quoted-printable';
$this->build_params['text_encoding'] = '7bit';
$this->build_params['html_charset'] = constant('CHARSET');
$this->build_params['text_charset'] = constant('CHARSET');
$this->build_params['text_wrap'] = 998;

/**
* Make sure the MIME version header is first.
*/

$this->headers[] = 'MIME-Version: 1.0';

reset($headers);
while (list(,$value) = each($headers)) {
if (tep_not_null($value)) {
$this->headers[] = $value;
}
}
}



And, general.php, Lines 962 - 979:

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

// Build the text version
$text = strip_tags($email_text);
if (EMAIL_USE_HTML == 'true') {
$message->add_html($email_text, $text);
} else {
$message->add_text($text);
}

// Send message
$message->build_message();
$message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
}

michael_s
09-14-2003, 02:06 PM
What are your server specs?

Markus
09-15-2003, 06:24 AM
This solves the bug...
http://forums.oscommerce.com/index.php?showtopic=56342&st=0&#entry229803