Commit c801a19b authored by Ad Schellevis's avatar Ad Schellevis

(mvc) fix integer validator to deny leading zeros

parent e7f6619d
...@@ -51,8 +51,7 @@ class IntegerValidator extends Validator implements ValidatorInterface ...@@ -51,8 +51,7 @@ class IntegerValidator extends Validator implements ValidatorInterface
{ {
$value = $validator->getValue($attribute); $value = $validator->getValue($attribute);
$msg = $this->getOption('message'); $msg = $this->getOption('message');
if (ctype_digit(strval(($value))) == false or (string)((int)$value) !== (string)$value) {
if (ctype_digit(strval(($value))) == false) {
$validator->appendMessage(new Message($msg, $attribute, 'IntegerValidator')); $validator->appendMessage(new Message($msg, $attribute, 'IntegerValidator'));
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment