PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Mail » Mail_Queue » Bug #8655

Mail_Queue::put() documentation error (return value)

Details

Submitted2006-09-07 14:53 UTC
Fromrandy at rcs-comp dot com
Assignedquipo
StatusClosed
PackageMail_Queue
PHP Version5.1.6
OSn/a
Roadmaps(Not assigned)

Comments

[2006-09-07 14:53 UTC] randy at rcs-comp dot com

Description:
------------
The documentation for put() says:

Return value
------------------
returns True on success

Using the MDB2 container, it is returning an integer value which is the id of the just inserted record. I didn't check the other containers. It also appears from the code below that MDB2 container may also return an error object.

function put($time_to_send, $id_user, $ip, $sender,
$recipient, $headers, $body, $delete_after_send=true)
{
$id = $this->db->nextId($this->sequence);
if (empty($id) || MDB2::isError($id)) {
return new Mail_Queue_Error(MAILQUEUE_ERROR,
$this->pearErrorMode, E_USER_ERROR, __FILE__, __LINE__,
'Cannot create id in: '.$this->sequence);
}
$query = 'INSERT INTO '. $this->mail_table
.' (id, create_time, time_to_send, id_user, ip'
.', sender, recipient, headers, body, delete_after_send) VALUES ('
. $this->db->quote($id, 'integer')
.', ' . $this->db->quote(date("Y-m-d H:i:s"), 'timestamp')
.', ' . $this->db->quote($time_to_send, 'timestamp')
.', ' . $this->db->quote($id_user, 'integer')
.', ' . $this->db->quote($ip, 'text')
.', ' . $this->db->quote($sender, 'text')
.', ' . $this->db->quote($recipient, 'text')
.', ' . $this->db->quote($headers, 'text') //clob
.', ' . $this->db->quote($body, 'text') //clob
.', ' . ($delete_after_send ? 1 : 0)
.')';
$res = $this->db->query($query);
if (MDB2::isError($res)) {
return new Mail_Queue_Error(MAILQUEUE_ERROR_QUERY_FAILED,
$this->pearErrorMode, E_USER_ERROR, __FILE__, __LINE__,
'MDB2::query failed - "'.$query.'" - '.MDB2::errorMessage($res));
}
return $id;
}