Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.6

Bug #7242 Mail_mimeDecode: Notice: Uninitialized string offset
Submitted: 2006-03-29 10:00 UTC
From: luke dot richards at emailcenteruk dot com Assigned: alan_k
Status: Closed Package: Mail_mimeDecode (version 1.3.1)
PHP Version: 4.3.11 OS: Linux
Roadmaps: 1.6.0    
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
2010-09-02 16:53 UTC
Bug Type:
From: luke dot richards at emailcenteruk dot com
New email:
PHP Version: Package Version: OS:


 [2006-03-29 10:00 UTC] luke dot richards at emailcenteruk dot com (Luke Richards)
Description: ------------ 468c468 < if (is_array($param_value) AND $param_value[0] == '"') { --- > if ($param_value[0] == '"') { Test script: --------------- <?php require_once("Mail/mimeDecode.php"); // this is an email we received $string = file_get_contents(""); $params = array(); $params['include_bodies'] = true; $params['decode_bodies'] = true; $params['decode_headers'] = true; $parser = new Mail_mimeDecode($string); $structure = $parser->decode($params); print_r($structure); ?> Expected result: ---------------- The structure of the email is printed without any errors/notices. Actual result: -------------- The structure of the email is printed with the notice: Notice: Uninitialized string offset: 0 in /usr/share/php/Mail/mimeDecode.php on line 468


 [2006-03-29 10:02 UTC] luke dot richards at emailcenteruk dot com
Changed summary to be more descriptive...
 [2006-04-27 14:35 UTC] cipri (Cipriano Groenendal)
Moved to Mail_MimeDecode subpackage.
 [2007-07-11 13:33 UTC] schmidt (Christian Schmidt)
The suggested fix is wrong. $param_value is a string, and $param_value[0] is used to get the first character. The problem occurs, when $param_value is "", e.g. when a header like the following is encountered: Content-Type: text/plain; charset= Headers like these occur regularly in bounce messages generated by some mailservers. A better fix is something like this: - if ($param_value[0] == '"') { + if (substr($param_value, 0, 1) == '"') {
 [2007-08-03 06:47 UTC] schmidt (Christian Schmidt)
Any chance a fix for this will make it in the next release? I'd rather not have to use @ to mute errors from decode().
 [2008-01-22 09:17 UTC] yunosh (Jan Schneider)
This is a very straightforward, one-line fix, please apply. The notice can be triggered by any empty content type parameter, e.g.: Content-Type: multipart/signed; boundary="=_2tcul05gfp2c"; protocol="application/pkcs7-signature"; micalg="sha1"; name=""
 [2010-09-02 16:53 UTC] alan_k (Alan Knowles)
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: alan_k
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at