#29851 [Bgs]: Quotes in header From: corrupts imap_headerinfo

From: Date: Fri, 27 Aug 2004 01:03:49 +0000
Subject: #29851 [Bgs]: Quotes in header From: corrupts imap_headerinfo
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-65317@lists.php.net to get a copy of this message
ID: 29851 User updated by: janders at javeo dot com Reported By: janders at javeo dot com Status: Bogus Bug Type: IMAP related Operating System: RHEL V3 PHP Version: 4.3.8 New Comment: I disagree... Php is returning invalid data. Just because the From: field is invalid syntax, that doesn't mean that php should follow suit and provide invalid data. On call to imap_headerinfo, it's returning an invalid mailbox -- i.e., "30TV <carpenter@example.com>"@t1. The code should return an error message or error code, or should return "carpenter", which is the mailbox, and it should properly set "example.com" as the host object. Obviously php is mangling the original field in an attempt to return a valid mailbox string. So, if before returning the string, if php did a simple regexp to test for invalid chars like, if (!ereg("/^([a-zA-Z0-9_\.\-])+/", $str) then it could determin if the mailbox string was valid or not before returning yet another invalid string. Oh well, if not fixed in php I guess I'll have to run my 'if' condition against every mailbox returned by imap_headerinfo. Thanks again for your help, -JA Previous Comments: ------------------------------------------------------------------------ [2004-08-27 00:47:39] iliaa@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. The header seems to corrupt in the 1st place. ------------------------------------------------------------------------ [2004-08-26 16:51:51] janders at javeo dot com Description: ------------ Email message header with additional quotes in From: field corrupts results returned by imap_headerinfo. E.g. Message with this from field: From: "30"TV" <carpenter@example.com>" imap_headerinfo produces: stdClass Object ( [date] => Wed, 25 Aug 2004 19:16:52 -0800 [Date] => Wed, 25 Aug 2004 19:16:52 -0800 [subject] => Free to new members- Flat Screen TV [Subject] => Free to new members- Flat Screen TV [fromaddress] => "30TV <carpenter@example.com>"@t1 [from] => Array([0] => stdClass Object ( [mailbox] => 30TV <carpenter@example.com> [host] => t1 ) ) <snip...> Reading this message from imap server using Outlook produces correct results, with additional quotes simply removed. I also read this message from imap server using Pine, since php uses same c-client. When displaying the message header in Pine, Pine replaced the corrupt "From" field with the non-corrupt "To" field when message header is displayed in the Inbox. -JA ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29851&edit=1

« previous php.bugs (#65317) next »