Verot上傳類(class.upload.php v3.2)在上傳和MIME檢查時會出現錯誤。警告:preg_match錯誤(class.upload.php)
if (preg_match("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", $this->file_src_mime)) {
$this->file_src_mime = preg_replace("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime);
$this->log .= '- MIME validated as ' . $this->file_src_mime . '<br />';
} else {
$this->file_src_mime = null;
}
這發生的錯誤:
Warning: preg_match() [function.preg-match]: Compilation failed: invalid range in character class at offset 7 in class.upload.php on line 2616
感謝您的建議。
'-'應該進行轉義(這裏的類的創建者)太 - '\ - '或者放到底塊'[\。\ w-]' – 2014-11-23 18:06:16