diff --git a/src/Validator/WhiteList.php b/src/Validator/WhiteList.php index 0374acc8..8af11347 100755 --- a/src/Validator/WhiteList.php +++ b/src/Validator/WhiteList.php @@ -91,7 +91,7 @@ public function getDescription() */ public function isArray(): bool { - return true; + return false; } /** @@ -116,6 +116,10 @@ public function getType(): string */ public function isValid($value) { + if (\is_array($value)) { + return false; + } + $value = ($this->strict) ? $value : \strtolower($value); if (!\in_array($value, $this->list, $this->strict)) { diff --git a/tests/Validator/WhiteListTest.php b/tests/Validator/WhiteListTest.php index ec713ec6..dc9424f2 100755 --- a/tests/Validator/WhiteListTest.php +++ b/tests/Validator/WhiteListTest.php @@ -30,7 +30,7 @@ public function testIsValid() $this->assertEquals($whiteList->isValid(5), false); $this->assertEquals($whiteList->getList(), ['string1', 'string2', 3, 4]); $this->assertEquals($whiteList->getType(), \Utopia\Validator::TYPE_STRING); //string by default - $this->assertEquals($whiteList->isArray(), true); + $this->assertEquals($whiteList->isArray(), false); $whiteList = new WhiteList(['string1', 'string2', 3, 4], false);