浏览代码

Support validation patterns contains a forward slash

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3827 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 9 年之前
父节点
当前提交
f925d89651
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      application/forms.class.inc.php

+ 2 - 2
application/forms.class.inc.php

@@ -937,8 +937,8 @@ EOF
 	public function ReadParam(&$aValues)
 	{
 		parent::ReadParam($aValues);
-
-		if (($this->sValidationPattern != '') &&(!preg_match('/'.$this->sValidationPattern.'/', $aValues[$this->sCode])) ) 
+		$sPattern = '/'.str_replace('/', '\/', $this->sValidationPattern).'/'; // Escape the forward slashes since they are used as delimiters for preg_match
+		if (($this->sValidationPattern != '') && (!preg_match($sPattern, $aValues[$this->sCode])) ) 
 		{
 			$aValues[$this->sCode] = $this->defaultValue;
 		}