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

Bug #38 Undefined variable in mimedecode.php
Submitted: 2003-09-26 15:35 UTC
From: marcus at synchromedia dot co dot uk Assigned: gschlossnagle
Status: Closed Package: Mail_Mime
PHP Version: 4.3.2 OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 45 + 47 = ?

 
 [2003-09-26 15:35 UTC] marcus at synchromedia dot co dot uk
Description: ------------ I keep seeing these errors when I'm handling bounces: PHP Notice: Undefined variable: parts in /usr/local/ lib/php/Mail/ mimeDecode.php on line 470 That's this function: function _boundarySplit($input, $boundary) { $tmp = explode('--'.$boundary, $input); for ($i=1; $i<count($tmp)-1; $i++) { $parts[] = $tmp[$i]; } return $parts; } Obviously, if no boundaries are present in the message, $parts remains undefined. All that's need to fix it is $parts = array(); as the first line of the function. My copy of this file is labelled version 1.34.

Comments

 [2003-12-17 08:35 UTC] gchan at csufresno dot edu
I just downloaded (what I think) is the latest version of this package. I also get an error related to the parts variable in mimDecode.php (when I try to decode multipart mime messages encoded with mime.php). The problem seems to be how the quotes around the boundary string are handled. As a temporary fix, I modified the _boundarySplit() function to the following: function _boundarySplit($input, $boundary) { $parts = array(); $bs_possible = substr($boundary, 2, -2); $bs_check = '\"' . $bs_possible . '\"'; if ($boundary == $bs_check) { $boundary = $bs_possible; } $tmp = explode('--' . $boundary, $input); for ($i = 1; $i < count($tmp) - 1; $i++) { $parts[] = $tmp[$i]; } return $parts; } Which seems to be working right now...
 [2004-04-02 16:31 UTC] gschlossnagle at php dot net
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.