Browse Source

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 years ago
parent
commit
f925d89651
1 changed files with 2 additions and 2 deletions
  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;
 		}