瀏覽代碼

Fix for namespace parsing. UWash has a namespace prefix without a delimiter, which is perfectly legal.

Alexandros Vellis 18 年之前
父節點
當前提交
0f2d1a970e
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      functions/imap_general.php

+ 7 - 2
functions/imap_general.php

@@ -1118,9 +1118,14 @@ function sqimap_parse_namespace(&$input) {
                 if($c = preg_match_all('/\((?:(.*?)\s*?)\)/', $ns, $regs2)) {
                 if($c = preg_match_all('/\((?:(.*?)\s*?)\)/', $ns, $regs2)) {
                     $namespace[$ns_strings[$i]] = array();
                     $namespace[$ns_strings[$i]] = array();
                     for($j=0; $j<sizeof($regs2[1]); $j++) {
                     for($j=0; $j<sizeof($regs2[1]); $j++) {
-                        preg_match('/"(.*)"\s+"(.*)"/', $regs2[1][$j], $regs3);
+                        preg_match('/"(.*)"\s+("(.*)"|NIL)/', $regs2[1][$j], $regs3);
                         $namespace[$ns_strings[$i]][$j]['prefix'] = $regs3[1];
                         $namespace[$ns_strings[$i]][$j]['prefix'] = $regs3[1];
-                        $namespace[$ns_strings[$i]][$j]['delimiter'] = $regs3[2];
+                        if($regs3[2] == 'NIL') {
+                            $namespace[$ns_strings[$i]][$j]['delimiter'] = null;
+                        } else {
+                            // $regs[3] is $regs[2] without the quotes
+                            $namespace[$ns_strings[$i]][$j]['delimiter'] = $regs3[3];
+                        }
                         unset($regs3);
                         unset($regs3);
                     }
                     }
                 }
                 }