use is_int instead of is_numeric if we want to reject numeric strings, should fix #681
This commit is contained in:
parent
160f673060
commit
0f4a0275b5
@ -213,7 +213,7 @@ class Database
|
|||||||
// $stmt = $this->db->prepare($query);
|
// $stmt = $this->db->prepare($query);
|
||||||
if (!array_key_exists(0, $args)) {
|
if (!array_key_exists(0, $args)) {
|
||||||
foreach ($args as $name=>$value) {
|
foreach ($args as $name=>$value) {
|
||||||
if (is_numeric($value)) {
|
if (is_int($value)) {
|
||||||
$stmt->bindValue(':'.$name, $value, PDO::PARAM_INT);
|
$stmt->bindValue(':'.$name, $value, PDO::PARAM_INT);
|
||||||
} else {
|
} else {
|
||||||
$stmt->bindValue(':'.$name, $value, PDO::PARAM_STR);
|
$stmt->bindValue(':'.$name, $value, PDO::PARAM_STR);
|
||||||
|
@ -81,9 +81,9 @@ class Image
|
|||||||
}
|
}
|
||||||
$this->locked = bool_escape($this->locked);
|
$this->locked = bool_escape($this->locked);
|
||||||
|
|
||||||
assert(is_numeric($this->id));
|
assert(is_int($this->id));
|
||||||
assert(is_numeric($this->height));
|
assert(is_int($this->height));
|
||||||
assert(is_numeric($this->width));
|
assert(is_int($this->width));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,7 +503,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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user