Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed input validator Int

  • Loading branch information...
commit 2a2319289df07f52a97eab910ccb71437b4b6133 1 parent 933e221
@jarnix authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 library/php/classes/Nf/Input.php
View
13 library/php/classes/Nf/Input.php
@@ -201,11 +201,16 @@ private function metaFilterAndValidate($metaAction) {
// we will search for the function name in this class
$methodNameForOption=$metaAction . ucfirst($optionFunction);
if(in_array($methodNameForOption, $this->_classMethods)) {
- if(isset($optionParameter)) {
- $ret=self::$methodNameForOption($this->_fields[$paramName]['value'], $optionParameter, $this);
+ if($metaAction=='validate' && $optionName==self::V_REQUIRED) {
+ $ret=isset($this->_fields[$paramName]);
}
else {
- $ret=self::$methodNameForOption($this->_fields[$paramName]['value'], null, $this);
+ if(isset($optionParameter)) {
+ $ret=self::$methodNameForOption($this->_fields[$paramName]['value'], $optionParameter, $this);
+ }
+ else {
+ $ret=self::$methodNameForOption($this->_fields[$paramName]['value'], null, $this);
+ }
}
if($metaAction=='filter') {
$this->setField($paramName, $ret);
@@ -353,7 +358,7 @@ public static function filterUrl($value) {
// ************************************************************************
public static function validateInt($value){
- return (bool)preg_match(self::REGEXP_INT, $value);
+ return (self::filterInt($value)==$value);
}
public static function validateNatural($value) {
Please sign in to comment.
Something went wrong with that request. Please try again.