From b59b72cc3028cc0514e951f135d8bfe7efcaaa6f Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 26 Feb 2015 18:04:03 +0100 Subject: Fix "Non-static method PEAR::isError() should not be called statically" errors (#1490281) --- program/lib/Roundcube/rcube.php | 15 +++++++++------ program/lib/Roundcube/rcube_smtp.php | 14 ++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'program/lib/Roundcube') diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 3aca88843..20f509e3d 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -1681,15 +1681,18 @@ class rcube if ($message->getParam('delay_file_io')) { // use common temp dir - $temp_dir = $this->config->get('temp_dir'); - $body_file = tempnam($temp_dir, 'rcmMsg'); - if (PEAR::isError($mime_result = $message->saveMessageBody($body_file))) { + $temp_dir = $this->config->get('temp_dir'); + $body_file = tempnam($temp_dir, 'rcmMsg'); + $mime_result = $message->saveMessageBody($body_file); + + if (is_a($mime_result, 'PEAR_Error')) { self::raise_error(array('code' => 650, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Could not create message: ".$mime_result->getMessage()), - TRUE, FALSE); + true, false); return false; } + $msg_body = fopen($body_file, 'r'); } else { @@ -1732,11 +1735,11 @@ class rcube $msg_body = $message->get(); - if (PEAR::isError($msg_body)) { + if (is_a($msg_body, 'PEAR_Error')) { self::raise_error(array('code' => 650, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Could not create message: ".$msg_body->getMessage()), - TRUE, FALSE); + true, false); } else { $delim = $this->config->header_delimiter(); diff --git a/program/lib/Roundcube/rcube_smtp.php b/program/lib/Roundcube/rcube_smtp.php index b37b44426..0322a0d46 100644 --- a/program/lib/Roundcube/rcube_smtp.php +++ b/program/lib/Roundcube/rcube_smtp.php @@ -126,7 +126,7 @@ class rcube_smtp // try to connect to server and exit on failure $result = $this->conn->connect($CONFIG['smtp_timeout']); - if (PEAR::isError($result)) { + if (is_a($result, 'PEAR_Error')) { $this->response[] = "Connection failed: ".$result->getMessage(); $this->error = array('label' => 'smtpconnerror', 'vars' => array('code' => $this->conn->_code)); $this->conn = null; @@ -159,7 +159,7 @@ class rcube_smtp $result = $this->conn->auth($smtp_user, $smtp_pass, $smtp_auth_type, $use_tls, $smtp_authz); - if (PEAR::isError($result)) { + if (is_a($result, 'PEAR_Error')) { $this->error = array('label' => 'smtpautherror', 'vars' => array('code' => $this->conn->_code)); $this->response[] .= 'Authentication failure: ' . $result->getMessage() . ' (Code: ' . $result->getCode() . ')'; $this->reset(); @@ -240,7 +240,8 @@ class rcube_smtp } // set From: address - if (PEAR::isError($this->conn->mailFrom($from, $from_params))) { + $result = $this->conn->mailFrom($from, $from_params); + if (is_a($result, 'PEAR_Error')) { $err = $this->conn->getResponse(); $this->error = array('label' => 'smtpfromerror', 'vars' => array( 'from' => $from, 'code' => $err[0], 'msg' => $err[1])); @@ -252,7 +253,7 @@ class rcube_smtp // prepare list of recipients $recipients = $this->_parse_rfc822($recipients); - if (PEAR::isError($recipients)) { + if (is_a($recipients, 'PEAR_Error')) { $this->error = array('label' => 'smtprecipientserror'); $this->reset(); return false; @@ -260,7 +261,8 @@ class rcube_smtp // set mail recipients foreach ($recipients as $recipient) { - if (PEAR::isError($this->conn->rcptTo($recipient, $recipient_params))) { + $result = $this->conn->rcptTo($recipient, $recipient_params); + if (is_a($result, 'PEAR_Error')) { $err = $this->conn->getResponse(); $this->error = array('label' => 'smtptoerror', 'vars' => array( 'to' => $recipient, 'code' => $err[0], 'msg' => $err[1])); @@ -289,7 +291,7 @@ class rcube_smtp // Send the message's headers and the body as SMTP data. $result = $this->conn->data($data, $text_headers); - if (PEAR::isError($result)) { + if (is_a($result, 'PEAR_Error')) { $err = $this->conn->getResponse(); if (!in_array($err[0], array(354, 250, 221))) { $msg = sprintf('[%d] %s', $err[0], $err[1]); -- cgit v1.2.3