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