PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Mail » Mail_Queue » Bug #9065

MDB2 gives an error

Details

Submitted2006-10-17 03:21 UTC
Fromesharafu at it dot uts dot edu dot au
Assignedquipo
StatusClosed
PackageMail_Queue
PHP Version5.1.6
OSCentOs 4.2
Roadmaps(Not assigned)

Comments

[2006-10-17 03:21 UTC] esharafu at it dot uts dot edu dot au

Description:
------------
Setting the database type to MDB2 gives the following error:
Fatal error: Call to undefined method MDB2_Error::nextId() in /usr/local/lib/php/Mail/Queue/Container/mdb2.php on line 172

MDB2 version: 2.2.2 stable
PEAR version: 1.4.4 stable

The error doesn't occur with MDB.

Test script:
---------------
require_once "Mail/Queue.php";

// options for storing the messages
// type is the container used, currently there are db and mdb available
$db_options['type'] = 'mdb2';
// the others are the options for the used container
// here are some for db
$db_options['dsn'] = 'mysql://test:test@localhost/testdb';
$db_options['mail_table'] = 'mail_queue';

// here are the options for sending the messages themselves
// these are the options needed for the Mail-Class, especially used for Mail::factory()
$mail_options['driver'] = 'smtp';
$mail_options['host'] = 'mail.test.org';
$mail_options['port'] = 25;
$mail_options['localhost'] = 'localhost'; //optional Mail_smtp parameter
$mail_options['auth'] = false;
$mail_options['username'] = '';
$mail_options['password'] = '';

/* we use the db_options and mail_options here */
$mail_queue =& new Mail_Queue($db_options, $mail_options);

$from = 'no-reply@test.com';
$to = "test@test.com";
$message = 'Hi! This is test message!! :)';

$hdrs = array( 'From' => $from,
'To' => $to,
'Subject' => "test message body" );

/* we use Mail_mime() to construct a valid mail */
$mime =& new Mail_mime();
$mime->setTXTBody($message);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);

/* Put message to queue */
$mail_queue->put( $from, $to, $hdrs, $body );

Expected result:
----------------
blank page

Actual result:
--------------
Fatal error: Call to undefined method MDB2_Error::nextId() in /usr/local/lib/php/Mail/Queue/Container/mdb2.php on line 172