#45705 [Asn]: imap_rfc822_parse_adrlist() modifies passed address by adding NUL byte to it

From: Date: Mon, 04 Aug 2008 14:27:24 +0000
Subject: #45705 [Asn]: imap_rfc822_parse_adrlist() modifies passed address by adding NUL byte to it
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-127580@lists.php.net to get a copy of this message
ID: 45705 User updated by: jan at horde dot org Reported By: jan at horde dot org Status: Assigned Bug Type: IMAP related Operating System: Linux PHP Version: 5.3.0alpha1 Assigned To: jani New Comment: Looks like this only happens with imap_mail_compose() with uses rfc822_parse_adrlist(). imap_mail() with uses that function through _php_imap_mail() is not affected. New test: --TEST-- imap_rfc822_parse_adrlist() adding NUL byte to argument. --SKIPIF-- <?php if (!extension_exists('imap')) echo 'skip IMAP extension not installed'; ?> --FILE-- <?php $address = 'John Doe <john@example.com>'; imap_rfc822_parse_adrlist($address, null); echo $address; echo "\n"; $envelope = array('return_path' => 'John Doe <john@example.com>', 'from' => 'John Doe <john@example.com>', 'reply_to' => 'John Doe <john@example.com>', 'to' => 'John Doe <john@example.com>', 'cc' => 'John Doe <john@example.com>', 'bcc' => 'John Doe <john@example.com>'); imap_mail_compose($envelope, array(1 => array())); var_export($envelope); echo "\n"; $to = 'John Doe <john@example.com>'; $cc = 'John Doe <john@example.com>'; $bcc = 'John Doe <john@example.com>'; imap_mail($to, 'Subject', 'Body', '', $cc, $bcc); echo $to; echo "\n"; echo $cc; echo "\n"; echo $bcc; ?> --EXPECT-- John Doe <john@example.com> array ( 'return_path' => 'John Doe <john@example.com>', 'from' => 'John Doe <john@example.com>', 'reply_to' => 'John Doe <john@example.com>', 'to' => 'John Doe <john@example.com>', 'cc' => 'John Doe <john@example.com>', 'bcc' => 'John Doe <john@example.com>', ) John Doe <john@example.com> John Doe <john@example.com> John Doe <john@example.com> Previous Comments: ------------------------------------------------------------------------ [2008-08-04 13:36:05] jani@php.net Can't reproduce with PHP_5_2 branch. Looks like someone didn't bother merging some fixes from that branch to HEAD/PHP_5_3.. ------------------------------------------------------------------------ [2008-08-04 13:12:10] jani@php.net I guess this affects ALL places using rfc822_parse_adrlist() and not duplicating the passed data. I'll look into this. Maybe you could provide more tests those functions that use this c-client func? :) ------------------------------------------------------------------------ [2008-08-04 09:48:47] jan at horde dot org Description: ------------ imap_rfc822_parse_adrlist() adds a NUL byte (actually replace a space with one) in the passed string argument. Reproduce code: --------------- --TEST-- imap_rfc822_parse_adrlist() adding NUL byte to argument. --SKIPIF-- <?php if (!extension_exists('imap')) echo 'skip IMAP extension not installed'; ?> --FILE-- <?php $address = 'John Doe <john@example.com>'; imap_rfc822_parse_adrlist($address, null); echo $address; ?> --EXPECT-- John Doe <john@example.com> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45705&edit=1

« previous php.bugs (#127580) next »