xref: /PHP-5.3/ext/imap/tests/bug46918.phpt (revision 3af4a22a)
1--TEST--
2Bug #46918 (imap_rfc822_parse_adrlist host part not filled in correctly)
3--SKIPIF--
4<?php
5        if (!extension_loaded("imap")) {
6                die("skip imap extension not available");
7        }
8?>
9--FILE--
10<?php
11
12$adds = 'ian eiloart <iane@example.ac.uk>,
13      shuf6@example.ac.uk,
14      blobby,
15      "ian,eiloart"<ian@example.ac.uk>,
16      <@example.com:foo@example.ac.uk>,
17      foo@#,
18      ian@-example.com,
19      ian@one@two';
20$add_arr = imap_rfc822_parse_adrlist($adds, 'example.com');
21var_export($add_arr);
22
23?>
24--EXPECT--
25array (
26  0 =>
27  stdClass::__set_state(array(
28     'mailbox' => 'iane',
29     'host' => 'example.ac.uk',
30     'personal' => 'ian eiloart',
31  )),
32  1 =>
33  stdClass::__set_state(array(
34     'mailbox' => 'shuf6',
35     'host' => 'example.ac.uk',
36  )),
37  2 =>
38  stdClass::__set_state(array(
39     'mailbox' => 'blobby',
40     'host' => 'example.com',
41  )),
42  3 =>
43  stdClass::__set_state(array(
44     'mailbox' => 'ian',
45     'host' => 'example.ac.uk',
46     'personal' => 'ian,eiloart',
47  )),
48  4 =>
49  stdClass::__set_state(array(
50     'mailbox' => 'foo',
51     'host' => 'example.ac.uk',
52     'adl' => '@example.com',
53  )),
54  5 =>
55  stdClass::__set_state(array(
56     'mailbox' => 'foo',
57     'host' => '#',
58  )),
59  6 =>
60  stdClass::__set_state(array(
61     'mailbox' => 'ian',
62     'host' => '-example.com',
63  )),
64  7 =>
65  stdClass::__set_state(array(
66     'mailbox' => 'ian',
67     'host' => 'one',
68  )),
69  8 =>
70  stdClass::__set_state(array(
71     'mailbox' => 'UNEXPECTED_DATA_AFTER_ADDRESS',
72     'host' => '.SYNTAX-ERROR.',
73  )),
74)
75Notice: Unknown: Unexpected characters at end of address: @two (errflg=3) in Unknown on line 0
76