#49529 [Opn->Fbk]: imap_mail_compose changes passed parameters
| From: | jani@php.net | Date: | Fri, 11 Sep 2009 13:33:25 +0000 |
| Subject: | #49529 [Opn->Fbk]: imap_mail_compose changes passed parameters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-142250@lists.php.net to get a copy of this message | ||
ID: 49529
Updated by: jani@php.net
Reported By: hrynek at hrynek dot com
-Status: Open
+Status: Feedback
Bug Type: IMAP related
Operating System: Linux
PHP Version: 5.2.10
New Comment:
Please try using this snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
I can not reproduce this using your example script.
Previous Comments:
------------------------------------------------------------------------
[2009-09-11 11:24:12] hrynek at hrynek dot com
Description:
------------
imap_mail_compose() corrupts passed $envelope parameter, even passed
indirectly - check $headers and $this->headers used in sample code.
All address headers (from, to, cc, bcc, reply_to etc.) are changed and
variable can't be passed to imap_mail_compose() next time, beacause
function produces notice and wrong mail headers:
From: Asdf@NO HOST, UNEXPECTED_DATA_AFTER_ADDRESS@.SYNTAX-ERROR.
Any modification (uncomment line in sample) to variable
prevents changes to $this->headers, but $headers is still being
modified.
Reproduce code:
---------------
class test {
protected $headers = array("from" => "Asdf Qwer
<asdf@qwer.invalid>");
protected $body = array(array(
"type" => TYPETEXT,
"subtype" => "plain",
"contents.data" => "test message",
));
protected function getHeaders() {
return $this->headers;
}
public function compose() {
$headers = $this->getHeaders();
//$headers["from"] .= ""; // uncomment to fix
var_dump($this->headers["from"]);
imap_mail_compose($headers, $this->body);
var_dump($this->headers["from"]);
}
}
$test = new test();
$test->compose();
Expected result:
----------------
string(29) "Asdf Qwer <asdf@qwer.invalid>"
string(29) "Asdf Qwer <asdf@qwer.invalid>"
Actual result:
--------------
string(29) "Asdf Qwer <asdf@qwer.invalid>"
string(29) "Asdf Qwer<asdf@qwer.invalid>"
One space is replaced by 0x00.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49529&edit=1