diff --git a/include/class.format.php b/include/class.format.php index 99a708c6eeb7d770e8933ce71ef840404df73308..55635f5aab7d6cd57dc6ad9b90c3cc9ff37b6ce3 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -73,9 +73,10 @@ class Format { $str.= Format::encode($part->text, $part->charset, $encoding); $text = $str; - } elseif(function_exists('iconv_mime_decode')) { + } elseif($text[0] == '=' && function_exists('iconv_mime_decode')) { $text = iconv_mime_decode($text, 0, $encoding); - } elseif(!strcasecmp($encoding, 'utf-8') && function_exists('imap_utf8')) { + } elseif(!strcasecmp($encoding, 'utf-8') + && function_exists('imap_utf8')) { $text = imap_utf8($text); } diff --git a/include/class.mailparse.php b/include/class.mailparse.php index c2d0cac78cd13567695111233879c60f9c2da6f2..4038f1226fa53b3a038bbea912ada03e3ceaf108 100644 --- a/include/class.mailparse.php +++ b/include/class.mailparse.php @@ -513,12 +513,18 @@ class Mail_Parse { $parsed = Mail_RFC822::parseAddressList($address, null, null,false); - if(PEAR::isError($parsed)) + if (PEAR::isError($parsed)) return array(); + // Decode name and mailbox foreach ($parsed as $p) { $p->personal = Format::mimedecode($p->personal, $this->charset); + // Some mail clients may send ISO-8859-1 strings without proper encoding. + // Also, handle the more sane case where the mailbox is properly encoded + // against RFC2047 + $p->mailbox = Format::mimedecode($p->mailbox, $this->charset); } + return $parsed; } diff --git a/include/class.orm.php b/include/class.orm.php index d638a7dc9c2fd02a28e6778d9c246a2e0c81db10..12bc89072444fbbcb44032f2afb5818d9fe3619a 100644 --- a/include/class.orm.php +++ b/include/class.orm.php @@ -1021,8 +1021,6 @@ class MysqlExecutor { function _prepare() { $this->execute(); $this->_setup_output(); - if (!$this->stmt->store_result()) - throw new OrmException('Unable to process query: '.$this->stmt->error); } function execute() { @@ -1031,7 +1029,7 @@ class MysqlExecutor { .' '.$this->sql); if (count($this->params)) $this->_bind($this->params); - if (!$this->stmt->execute()) { + if (!$this->stmt->execute() || ! $this->stmt->store_result()) { throw new OrmException('Unable to execute query: ' . $this->stmt->error); } return true;