|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-09-11 13:33 UTC] jani@php.net
[2009-09-19 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 10:00:01 2025 UTC |
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.