xref: /PHP-8.2/ext/imap/tests/bug80215.phpt (revision 74859783)
1--TEST--
2Bug #80215 (imap_mail_compose() may modify by-val parameters)
3--EXTENSIONS--
4imap
5--FILE--
6<?php
7$envelope = [
8    "from" => 1,
9    "to" => 2,
10    "custom_headers" => [3],
11];
12$body = [[
13    "contents.data" => 4,
14    "type.parameters" => ['foo' => 5],
15    "disposition" => ['bar' => 6],
16], [
17    "contents.data" => 7,
18    "type.parameters" => ['foo' => 8],
19    "disposition" => ['bar' => 9],
20]];
21imap_mail_compose($envelope, $body);
22var_dump($envelope, $body);
23?>
24--EXPECT--
25array(3) {
26  ["from"]=>
27  int(1)
28  ["to"]=>
29  int(2)
30  ["custom_headers"]=>
31  array(1) {
32    [0]=>
33    int(3)
34  }
35}
36array(2) {
37  [0]=>
38  array(3) {
39    ["contents.data"]=>
40    int(4)
41    ["type.parameters"]=>
42    array(1) {
43      ["foo"]=>
44      int(5)
45    }
46    ["disposition"]=>
47    array(1) {
48      ["bar"]=>
49      int(6)
50    }
51  }
52  [1]=>
53  array(3) {
54    ["contents.data"]=>
55    int(7)
56    ["type.parameters"]=>
57    array(1) {
58      ["foo"]=>
59      int(8)
60    }
61    ["disposition"]=>
62    array(1) {
63      ["bar"]=>
64      int(9)
65    }
66  }
67}
68