Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a patch that should fix this problem, and fixes the problem where the previous code was counting escaped quotes inside of quoted string. RFC 822 does not require that quotes be closed inside the string, so these quotes need to be ignored. Bug: #9137 git-svn-id: http://svn.php.net/repository/pear/packages/Mail/trunk@260832 c90b9560-bf6c-de11-be94-00142212c4b1
- Loading branch information
Chuck Hagenbuch
committed
Jun 6, 2008
1 parent
c7c6aa8
commit 843f9a0
Showing
3 changed files
with
65 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,35 @@ | |||
--TEST-- | |||
Mail: Test for bug #9137, take 2 | |||
--FILE-- | |||
<?php | |||
|
|||
require_once dirname(__FILE__) . '/../Mail/RFC822.php'; | |||
require_once 'PEAR.php'; | |||
|
|||
$addresses = array( | |||
array('raw' => '"John Doe" <test@example.com>'), | |||
array('raw' => '"John Doe' . chr(92) . '" <test@example.com>'), | |||
array('raw' => '"John Doe' . chr(92) . chr(92) . '" <test@example.com>'), | |||
array('raw' => '"John Doe' . chr(92) . chr(92) . chr(92) . '" <test@example.com>'), | |||
array('raw' => '"John Doe' . chr(92) . chr(92) . chr(92) . chr(92) . '" <test@example.com>'), | |||
array('raw' => '"John Doe <test@example.com>'), | |||
); | |||
|
|||
for ($i = 0; $i < count($addresses); $i++) { | |||
// construct the address | |||
$address = $addresses[$i]['raw']; | |||
$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> :: Failed to validate | |||
"John Doe\\" <test@example.com> :: Parsed | |||
"John Doe\\\" <test@example.com> :: Failed to validate | |||
"John Doe\\\\" <test@example.com> :: Parsed | |||
"John Doe <test@example.com> :: Failed to validate |