Browse Source

Strings with ) are not counted in mime_match_parenthesis()

Tyler Akins 25 years ago
parent
commit
cffb2e9b1f
1 changed files with 8 additions and 0 deletions
  1. 8 0
      functions/mime.php

+ 8 - 0
functions/mime.php

@@ -337,11 +337,19 @@
       $char = substr($structure, $pos, 1); 
 
       // ignore all extra characters
+      // If inside of a string, skip string -- Boundary IDs and other
+      // things can have ) in them.
       while ($pos < strlen($structure)) {
          $pos++;
          $char = substr($structure, $pos, 1); 
          if ($char == ")") {
             return $pos;
+         } else if ($char == '"') {
+            $pos ++;
+            while (substr($structure, $pos, 1) != '"' && 
+               $pos < strlen($structure)) {
+               $pos ++;
+            }
          } else if ($char == "(") {
             $pos = mime_match_parenthesis ($pos, $structure);
          }