浏览代码

Strings with ) are not counted in mime_match_parenthesis()

Tyler Akins 25 年之前
父节点
当前提交
cffb2e9b1f
共有 1 个文件被更改,包括 8 次插入0 次删除
  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);
          }