From 5fc484640a9c5ab056b1d8a50716445fcef328cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 30 Oct 2020 10:40:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Validator/TypesOfValidator.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Validator/TypesOfValidator.php b/Validator/TypesOfValidator.php index bb357ed4..ee277e45 100644 --- a/Validator/TypesOfValidator.php +++ b/Validator/TypesOfValidator.php @@ -123,11 +123,10 @@ class TypesOfValidator extends BaseValidator */ public function integerFormat($value) { - $trim = trim($value); - if (!is_numeric($trim)) { + if (!is_numeric($value)) { return $this->addError('The ' . $this->field . ' not is number data.'); } - if ($trim != $value || intval($trim) != $value) { + if (intval($value) != $value) { return $this->addError('The ' . $this->field . ' not is number data.'); } @@ -140,7 +139,7 @@ class TypesOfValidator extends BaseValidator */ public function floatFormat($value) { - $trim = floatval(trim($value)); + $trim = floatval((string)$value); if ($trim != $value || !is_float($trim)) { return $this->addError('The ' . $this->field . ' not is float data.'); }