diff options
author | Thomas Lange <code@nerdmind.de> | 2023-09-23 23:08:02 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2023-09-23 23:19:38 +0200 |
commit | 09f52cfcc8ced8bed60e5c1702e6f35cf3fe1f29 (patch) | |
tree | ab426c212eb030dee4bb81099a26a4c5d7666ada /core/namespace | |
parent | 682c761c39d7368928201fe5eb4a3481eca89e35 (diff) | |
download | blog-09f52cfcc8ced8bed60e5c1702e6f35cf3fe1f29.tar.gz blog-09f52cfcc8ced8bed60e5c1702e6f35cf3fe1f29.tar.xz blog-09f52cfcc8ced8bed60e5c1702e6f35cf3fe1f29.zip |
Pass NULL instead of array containing NULL element
Diffstat (limited to 'core/namespace')
-rw-r--r-- | core/namespace/ORM/Repositories/CategoryRepository.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/namespace/ORM/Repositories/CategoryRepository.php b/core/namespace/ORM/Repositories/CategoryRepository.php index 8692079..7c7b3f9 100644 --- a/core/namespace/ORM/Repositories/CategoryRepository.php +++ b/core/namespace/ORM/Repositories/CategoryRepository.php @@ -42,7 +42,13 @@ class CategoryRepository extends Repository { $query = sprintf($query, $table, $field, $check, $table); $Statement = $this->Database->prepare($query); - $Statement->execute([$value]); + $Statement->execute( + # If $value is NULL, pass NULL instead of an array with one NULL + # element. PHP >= 8 will throw a PDOException when the number of + # bound variables doesn't matches the number of tokens ("?") in + # the SQL query, which is the case here if $value is NULL. + is_null($value) ? NULL : [$value] + ); # TODO: Virtual column _depth shall not be fetched into the entity class return $this->fetchEntities($Statement); |