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

Bug #11263 content disposition filename bug with apostophe
Submitted: 2007-06-10 08:24 UTC
From: xnote Assigned: cipri
Status: Closed Package: Mail_mimeDecode
PHP Version: 5.2.1 OS: Fedora 7
Roadmaps: (Not assigned)    
Subscription  


 [2007-06-10 08:24 UTC] xnote (Alan Fullmer)
Description: ------------ I have found that the function _parseHeaderValue skips any filename with an apostrophe in it. For example, If I were to send a file/attachment with the filename="Ain't it beautiful" it would skip due to the ' in Ain't. I did a str_replace on $input after strlen($input) and omitted the ' and it works correctly. I don't know if it's the regex incorrectly parsing due to my novice knowledge of regular expressions. Test script: --------------- if (($pos = strpos($input, ';')) !== false) { $return['value'] = trim(substr($input, 0, $pos)); $input = trim(substr($input, $pos+1)); if (strlen($input) > 0) { $input = str_replace("'","",$input); // This splits on a semi-colon, if there's no preceeding backslash // Now works with quoted values; had to glue the \; breaks in PHP // the regex is already bordering on incomprehensible $splitRegex = '/([^;\'"]*[\'"]([^\'"]*([^\'"]*)*)[\'"][^;\'"]*|([^;]+))(;|$)/'; preg_match_all($splitRegex, $input, $matches); $parameters = array(); for ($i=0; $i<count($matches[0]); $i++) { $param = $matches[0][$i]; while (substr($param, -2) == '\;') { $param .= $matches[0][++$i]; } $parameters[] = $param; } Expected result: ---------------- n/a no need to expound due to it's simplicity of explaining it beforehand. Actual result: -------------- n/a no need to expound due to it's simplicity of explaining it beforehand.

Comments

 [2010-09-02 17:48 UTC] alan_k (Alan Knowles)
-Status: Assigned +Status: Closed
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/