-
Notifications
You must be signed in to change notification settings - Fork 77
/
9137_2.phpt
35 lines (31 loc) · 1.2 KB
/
9137_2.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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