From:             hrynek at hrynek dot com
Operating system: Linux
PHP version:      5.2.10
PHP Bug Type:     IMAP related
Bug description:  imap_mail_compose changes passed parameters

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 bug report at http://bugs.php.net/?id=49529&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49529&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49529&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49529&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49529&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49529&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49529&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49529&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49529&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49529&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49529&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49529&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49529&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49529&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49529&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49529&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49529&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49529&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49529&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49529&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49529&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49529&r=mysqlcfg

Reply via email to