Bug #80215 [NEW]: imap_mail_compose() may modify by-val parameters
| From: | cmb@php.net | Date: | Sat, 10 Oct 2020 12:39:13 +0000 |
| Subject: | Bug #80215 [NEW]: imap_mail_compose() may modify by-val parameters | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-229506@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: *
PHP version: 7.3Git-2020-10-10 (Git)
Package: IMAP related
Bug Type: Bug
Bug description:imap_mail_compose() may modify by-val parameters
Description:
------------
imap_mail_compose() accepts two possibly nested arrays of strings,
and due to type juggling, may actually convert the elements to
string.
Test script:
---------------
<?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);
?>
Expected result:
----------------
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)
}
}
}
Actual result:
--------------
array(3) {
["from"]=>
string(1) "1"
["to"]=>
string(1) "2"
["custom_headers"]=>
array(1) {
[0]=>
string(1) "3"
}
}
array(2) {
[0]=>
array(3) {
["contents.data"]=>
string(1) "4"
["type.parameters"]=>
array(1) {
["foo"]=>
string(1) "5"
}
["disposition"]=>
array(1) {
["bar"]=>
string(1) "6"
}
}
[1]=>
array(3) {
["contents.data"]=>
string(1) "7"
["type.parameters"]=>
array(1) {
["foo"]=>
string(1) "8"
}
["disposition"]=>
array(1) {
["bar"]=>
string(1) "9"
}
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=80215&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80215&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80215&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80215&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80215&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80215&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80215&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80215&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80215&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80215&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80215&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80215&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80215&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80215&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80215&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80215&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80215&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80215&r=mysqlcfg