bool_escape('1') should be True
This commit is contained in:
parent
41ce16f1b8
commit
86d93b2cc2
2 changed files with 4 additions and 1 deletions
|
@ -490,7 +490,7 @@ function bool_escape($input): bool
|
||||||
*/
|
*/
|
||||||
if (is_bool($input)) {
|
if (is_bool($input)) {
|
||||||
return $input;
|
return $input;
|
||||||
} elseif (is_numeric($input)) {
|
} elseif (is_int($input)) {
|
||||||
return ($input === 1);
|
return ($input === 1);
|
||||||
} else {
|
} else {
|
||||||
$value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
$value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
||||||
|
|
|
@ -59,6 +59,9 @@ class PolyfillsTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
$this->assertTrue(bool_escape(1));
|
$this->assertTrue(bool_escape(1));
|
||||||
$this->assertFalse(bool_escape(0));
|
$this->assertFalse(bool_escape(0));
|
||||||
|
|
||||||
|
$this->assertTrue(bool_escape("1"));
|
||||||
|
$this->assertFalse(bool_escape("0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_clamp()
|
public function test_clamp()
|
||||||
|
|
Reference in a new issue