Permalink
Browse files

Test for bug 9137

git-svn-id: http://svn.php.net/repository/pear/packages/Mail/trunk@239269 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 9a428dc commit 42e225444e28ce24f2cc9ed1031ae581440dd547 Chuck Hagenbuch committed Jul 8, 2007
Showing with 30 additions and 0 deletions.
  1. +30 −0 tests/9137.phpt
View
@@ -0,0 +1,30 @@
+--TEST--
+Mail: Test for bug #9137
+--FILE--
+<?php
+
+require_once 'Mail/RFC822.php';
+require_once 'PEAR.php';
+
+$addresses = array(
+ array('name' => 'John Doe', 'email' => 'test@example.com'),
+ array('name' => 'John Doe\\', 'email' => 'test@example.com'),
+);
+
+for ($i = 0; $i < count($addresses); $i++) {
+ // construct the address
+ $address = "\"" . addslashes($addresses[$i]['name']) . "\" ".
+ "<".$addresses[$i]['email'].">";
+
+ $parsedAddresses = Mail_RFC822::parseAddressList($address);
+
+ if (PEAR::isError($parsedAddresses)) {
+ echo $address." :: Failed to validate\n";
+ } else {
+ echo $address." :: Parsed\n";
+ }
+}
+
+--EXPECT--
+"John Doe" <test@example.com> :: Parsed
+"John Doe\\" <test@example.com> :: Parsed

0 comments on commit 42e2254

Please sign in to comment.