Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug #13659 - applied test / patch

git-svn-id: http://svn.php.net/repository/pear/packages/Mail/trunk@294749 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 49c3cd655366d8a004beda778493c9eab970aa5b 1 parent ead639e
@CloCkWeRX CloCkWeRX authored
Showing with 27 additions and 2 deletions.
  1. +2 −2 Mail/RFC822.php
  2. +25 −0 tests/13659.phpt
View
4 Mail/RFC822.php
@@ -646,8 +646,8 @@ function validateMailbox(&$mailbox)
$comment = $this->_splitCheck($parts, ')');
$comments[] = $comment;
- // +1 is for the trailing )
- $_mailbox = substr($_mailbox, strpos($_mailbox, $comment)+strlen($comment)+1);
+ // +2 is for the brackets
+ $_mailbox = substr($_mailbox, strpos($_mailbox, '('.$comment)+strlen($comment)+2);
} else {
break;
}
View
25 tests/13659.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Mail: Test for bug #13659
+--FILE--
+<?php
+
+//require_once dirname(__FILE__) . '/../Mail/RFC822.php';
+require_once 'Mail/RFC822.php';
+require_once 'PEAR.php';
+
+$address = '"Test Student" <test@mydomain.com> (test)';
+$result = Mail_RFC822::parseAddressList($address, 'anydomain.com', TRUE);
+
+if (!PEAR::isError($result) && is_array($result) && is_object($result[0]))
+ if ($result[0]->personal == '"Test Student"' &&
+ $result[0]->mailbox == "test" &&
+ $result[0]->host == "mydomain.com" &&
+ is_array($result[0]->comment) && $result[0]->comment[0] == 'test')
+ {
+ print("OK");
+ }
+
+
+?>
+--EXPECT--
+OK
Please sign in to comment.
Something went wrong with that request. Please try again.