Skip to content

Commit

Permalink
Core: fixed bad SQL_DATETIME_ZERO_VARIANTS tests
Browse files Browse the repository at this point in the history
See #243.
  • Loading branch information
xenocrat committed Mar 3, 2024
1 parent c7e1ce3 commit 3a6bf10
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion includes/class/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ protected static function grab($model, $id, $options = array()): void {
if (isset($model->updated_at))
$model->updated = (
!empty($model->updated_at) and
!in_array($model->updated_at, SQL_DATETIME_ZERO_VARIANTS)
!in_array($model->updated_at, SQL_DATETIME_ZERO_VARIANTS, true)
);

# Clone the object and cache it.
Expand Down
4 changes: 2 additions & 2 deletions includes/class/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static function build_insert(

if (
$key == "updated_at" and
in_array($val, SQL_DATETIME_ZERO_VARIANTS)
in_array($val, SQL_DATETIME_ZERO_VARIANTS, true)
)
$val = SQL_DATETIME_ZERO;

Expand Down Expand Up @@ -683,7 +683,7 @@ public static function build_conditions(
if ($insert) {
if (
$key == "updated_at" and
in_array($val, SQL_DATETIME_ZERO_VARIANTS)
in_array($val, SQL_DATETIME_ZERO_VARIANTS, true)
)
$val = SQL_DATETIME_ZERO;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ function oneof(): mixed {
!isset($arg) or $arg === array() or
(is_string($arg) and trim($arg) === "") or
(is_object($arg) and empty($arg)) or
in_array($arg, SQL_DATETIME_ZERO_VARIANTS)
in_array($arg, SQL_DATETIME_ZERO_VARIANTS, true)
);

if (!$unset)
Expand Down

0 comments on commit 3a6bf10

Please sign in to comment.