cvs: pear /Mail package.xml /Mail/Mail mail.php sendmail.php smtp.php
| From: | Jon Parise | Date: | Thu, 09 Sep 2004 02:08:55 +0000 |
| Subject: | cvs: pear /Mail package.xml /Mail/Mail mail.php sendmail.php smtp.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-23739@lists.php.net to get a copy of this message | ||
jon Wed Sep 8 22:08:55 2004 EDT
Modified files:
/pear/Mail package.xml
/pear/Mail/Mail mail.php sendmail.php smtp.php
Log:
Mail::parseHeaders() may return a PEAR_Error object (generated by the
underlying Mail_RFC822 routines). The various send() implementations need
to detect and escape that object before they attempt to use it in an array
context (which is a fatal error under PHP5).
Inspired by bug: 2242
http://cvs.php.net/diff.php/pear/Mail/package.xml?r1=1.22&r2=1.23&ty=u
Index: pear/Mail/package.xml
diff -u pear/Mail/package.xml:1.22 pear/Mail/package.xml:1.23
--- pear/Mail/package.xml:1.22 Wed Sep 8 21:12:49 2004
+++ pear/Mail/package.xml Wed Sep 8 22:08:54 2004
@@ -40,6 +40,7 @@
- PHP5 compatibility fix (Bug #1563).
- PHP4 / Win32 compatibility fix for the 'sendmail' driver (Bug 1881).
- Stricter "local part" parsing for Mail_RFC822 (in accordance with Section 6.2.4 of RFC
822) (Bug 1869).
+- The various send() implementations now properly escalate the PEAR_Error object returned by
Mail::prepareHeaders() in the event of an invalid header.
</notes>
<state>stable</state>
<filelist>
http://cvs.php.net/diff.php/pear/Mail/Mail/mail.php?r1=1.12&r2=1.13&ty=u
Index: pear/Mail/Mail/mail.php
diff -u pear/Mail/Mail/mail.php:1.12 pear/Mail/Mail/mail.php:1.13
--- pear/Mail/Mail/mail.php:1.12 Fri Sep 3 16:32:51 2004
+++ pear/Mail/Mail/mail.php Wed Sep 8 22:08:55 2004
@@ -16,12 +16,12 @@
// | Author: Chuck Hagenbuch <chuck@horde.org> |
// +----------------------------------------------------------------------+
//
-// $Id: mail.php,v 1.12 2004/09/03 20:32:51 chagenbu Exp $
+// $Id: mail.php,v 1.13 2004/09/09 02:08:55 jon Exp $
/**
* internal PHP-mail() implementation of the PEAR Mail:: interface.
* @package Mail
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
*/
class Mail_mail extends Mail {
@@ -99,7 +99,11 @@
}
// Flatten the headers out.
- list(,$text_headers) = Mail::prepareHeaders($headers);
+ $headerElements = $this->prepareHeaders($headers);
+ if (PEAR::isError($headerElements)) {
+ return $headerElements;
+ }
+ list(, $text_headers) = $headerElements;
/*
* We only use mail()'s optional fifth parameter if the additional
http://cvs.php.net/diff.php/pear/Mail/Mail/sendmail.php?r1=1.7&r2=1.8&ty=u
Index: pear/Mail/Mail/sendmail.php
diff -u pear/Mail/Mail/sendmail.php:1.7 pear/Mail/Mail/sendmail.php:1.8
--- pear/Mail/Mail/sendmail.php:1.7 Fri Sep 3 16:32:51 2004
+++ pear/Mail/Mail/sendmail.php Wed Sep 8 22:08:55 2004
@@ -20,7 +20,7 @@
* Sendmail implementation of the PEAR Mail:: interface.
* @access public
* @package Mail
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
class Mail_sendmail extends Mail {
@@ -102,7 +102,12 @@
}
$recipients = escapeShellCmd(implode(' ', $recipients));
- list($from, $text_headers) = $this->prepareHeaders($headers);
+ $headerElements = $this->prepareHeaders($headers);
+ if (PEAR::isError($headerElements)) {
+ return $headerElements;
+ }
+ list($from, $text_headers) = $headerElements;
+
if (!isset($from)) {
return PEAR::raiseError('No from address given.');
} elseif (strstr($from, ' ') ||
http://cvs.php.net/diff.php/pear/Mail/Mail/smtp.php?r1=1.16&r2=1.17&ty=u
Index: pear/Mail/Mail/smtp.php
diff -u pear/Mail/Mail/smtp.php:1.16 pear/Mail/Mail/smtp.php:1.17
--- pear/Mail/Mail/smtp.php:1.16 Wed Jul 28 20:23:01 2004
+++ pear/Mail/Mail/smtp.php Wed Sep 8 22:08:55 2004
@@ -22,7 +22,7 @@
* Net_SMTP:: class.
* @access public
* @package Mail
- * @version $Revision: 1.16 $
+ * @version $Revision: 1.17 $
*/
class Mail_smtp extends Mail {
@@ -169,7 +169,11 @@
}
}
- list($from, $text_headers) = $this->prepareHeaders($headers);
+ $headerElements = $this->prepareHeaders($headers);
+ if (PEAR::isError($headerElements)) {
+ return $headerElements;
+ }
+ list($from, $text_headers) = $headerElements;
/* Since few MTAs are going to allow this header to be forged
* unless it's in the MAIL FROM: exchange, we'll use