bool_escape('1') should be True

This commit is contained in:
Shish 2020-01-29 20:20:17 +00:00
parent 41ce16f1b8
commit 86d93b2cc2
2 changed files with 4 additions and 1 deletions

View file

@ -490,7 +490,7 @@ function bool_escape($input): bool
*/
if (is_bool($input)) {
return $input;
} elseif (is_numeric($input)) {
} elseif (is_int($input)) {
return ($input === 1);
} else {
$value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);

View file

@ -59,6 +59,9 @@ class PolyfillsTest extends \PHPUnit\Framework\TestCase
$this->assertTrue(bool_escape(1));
$this->assertFalse(bool_escape(0));
$this->assertTrue(bool_escape("1"));
$this->assertFalse(bool_escape("0"));
}
public function test_clamp()