diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-10 17:16:41 +0200 |
|---|---|---|
| committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-10 23:25:06 +0200 |
| commit | 62a2387a8dc262ae75a6575fabddd6170b4bdb07 (patch) | |
| tree | 9e8ba11ed165238fe6d71e9b1d371707bc31e358 /ext/imap/tests | |
| parent | 8bee0fbd37c8eee0a17abe4a0afd69ad9ac7105a (diff) | |
| download | php-git-62a2387a8dc262ae75a6575fabddd6170b4bdb07.tar.gz | |
Fix #80215: imap_mail_compose() may modify by-val parameters
We separate the input arrays and all sub-arrays to avoid modification
of the passed parameters.
This should be rewritten to use `zend_string`s for the "master" branch.
Closes GH-6316.
Diffstat (limited to 'ext/imap/tests')
| -rw-r--r-- | ext/imap/tests/bug80215.phpt | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/ext/imap/tests/bug80215.phpt b/ext/imap/tests/bug80215.phpt new file mode 100644 index 0000000000..b2d7c3ed09 --- /dev/null +++ b/ext/imap/tests/bug80215.phpt @@ -0,0 +1,69 @@ +--TEST-- +Bug #80215 (imap_mail_compose() may modify by-val parameters) +--SKIPIF-- +<?php +if (!extension_loaded('imap')) die('skip imap extension not available'); +?> +--FILE-- +<?php +$envelope = [ + "from" => 1, + "to" => 2, + "custom_headers" => [3], +]; +$body = [[ + "contents.data" => 4, + "type.parameters" => ['foo' => 5], + "disposition" => ['bar' => 6], +], [ + "contents.data" => 7, + "type.parameters" => ['foo' => 8], + "disposition" => ['bar' => 9], +]]; +imap_mail_compose($envelope, $body); +var_dump($envelope, $body); +?> +--EXPECT-- +array(3) { + ["from"]=> + int(1) + ["to"]=> + int(2) + ["custom_headers"]=> + array(1) { + [0]=> + int(3) + } +} +array(2) { + [0]=> + array(3) { + ["contents.data"]=> + int(4) + ["type.parameters"]=> + array(1) { + ["foo"]=> + int(5) + } + ["disposition"]=> + array(1) { + ["bar"]=> + int(6) + } + } + [1]=> + array(3) { + ["contents.data"]=> + int(7) + ["type.parameters"]=> + array(1) { + ["foo"]=> + int(8) + } + ["disposition"]=> + array(1) { + ["bar"]=> + int(9) + } + } +} |
