| 1 |
lars |
1 |
--TEST--
|
|
|
2 |
Mail: Test for bug #9137, take 2
|
|
|
3 |
--FILE--
|
|
|
4 |
<?php
|
|
|
5 |
|
|
|
6 |
require_once dirname(__FILE__) . '/../Mail/RFC822.php';
|
|
|
7 |
require_once 'PEAR.php';
|
|
|
8 |
|
|
|
9 |
$addresses = array(
|
|
|
10 |
array('raw' => '"John Doe" <test@example.com>'),
|
|
|
11 |
array('raw' => '"John Doe' . chr(92) . '" <test@example.com>'),
|
|
|
12 |
array('raw' => '"John Doe' . chr(92) . chr(92) . '" <test@example.com>'),
|
|
|
13 |
array('raw' => '"John Doe' . chr(92) . chr(92) . chr(92) . '" <test@example.com>'),
|
|
|
14 |
array('raw' => '"John Doe' . chr(92) . chr(92) . chr(92) . chr(92) . '" <test@example.com>'),
|
|
|
15 |
array('raw' => '"John Doe <test@example.com>'),
|
|
|
16 |
);
|
|
|
17 |
|
|
|
18 |
for ($i = 0; $i < count($addresses); $i++) {
|
|
|
19 |
// construct the address
|
|
|
20 |
$address = $addresses[$i]['raw'];
|
|
|
21 |
$parsedAddresses = Mail_RFC822::parseAddressList($address);
|
|
|
22 |
if (PEAR::isError($parsedAddresses)) {
|
|
|
23 |
echo $address." :: Failed to validate\n";
|
|
|
24 |
} else {
|
|
|
25 |
echo $address." :: Parsed\n";
|
|
|
26 |
}
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
--EXPECT--
|
|
|
30 |
"John Doe" <test@example.com> :: Parsed
|
|
|
31 |
"John Doe\" <test@example.com> :: Failed to validate
|
|
|
32 |
"John Doe\\" <test@example.com> :: Parsed
|
|
|
33 |
"John Doe\\\" <test@example.com> :: Failed to validate
|
|
|
34 |
"John Doe\\\\" <test@example.com> :: Parsed
|
|
|
35 |
"John Doe <test@example.com> :: Failed to validate
|