ID:               49529
 Updated by:       [email protected]
 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: a...@no HOST, [email protected].

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
<[email protected]>");
    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 <[email protected]>"
string(29) "Asdf Qwer <[email protected]>"

Actual result:
--------------
string(29) "Asdf Qwer <[email protected]>"
string(29) "Asdf Qwer<[email protected]>"

One space is replaced by 0x00.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=49529&edit=1

Reply via email to