PHP Classes

mime_parser.php error

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  mime_parser.php error  >  (Un) Subscribe thread alerts  
Subject:mime_parser.php error
Summary:Uninitialized string offset: 0 in mime_parser.php on line 417
Messages:5
Author:danilcha
Date:2010-04-07 19:43:03
Update:2010-04-09 11:29:50
 

  1. mime_parser.php error   Reply   Report abuse  
Picture of danilcha danilcha - 2010-04-07 19:43:03
Hello,

I'm using the latest version of mime_parser.php. I get PHP notice

Uninitialized string offset: 0 in mime_parser.php on line 417

when decoding a message with crappy headers:

| --_----------=_parties_54877eb9e489d85d6c1608e33f64cff2
| Content-Type: text/plain
|
| charset="utf-8"
| Content-Transfer-Encoding: 8bit

The error is in the last line:

Function ParseStructuredHeader($value, &$type, &$parameters, &$character_sets, &$languages)
{
$type = strtolower(trim($this->Tokenize($value, ';')));
$p = trim($this->Tokenize(''));
$parameters = $character_sets = $languages = array();
while(strlen($p))
{
$parameter = trim(strtolower($this->Tokenize($p, '=')));
$remaining = trim($this->Tokenize(''));
if(!strcmp($remaining[0], '"')

  2. Re: mime_parser.php error   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2010-04-07 20:00:42 - In reply to message 1 from danilcha
Can you upload a sample message somewhere so I can reproduce the problem?

  3. Re: mime_parser.php error   Reply   Report abuse  
Picture of danilcha danilcha - 2010-04-08 22:00:00 - In reply to message 2 from Manuel Lemos

  4. Re: mime_parser.php error   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2010-04-08 23:00:56 - In reply to message 3 from danilcha
That error is harmless and does not affect the results of message parsing.

Anyway, I fixed the problem and uploaded the fixed version. Thank you for reporting.

  5. Re: mime_parser.php error   Reply   Report abuse  
Picture of danilcha danilcha - 2010-04-09 11:29:51 - In reply to message 4 from Manuel Lemos
Thank you! Now my site doesn't print notice warning when opening incorrect messages.