Skip to content

Commit 820445b

Browse files
committed
Revert greptile comments
1 parent 0af3651 commit 820445b

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/Database/Adapter/MariaDB.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2067,7 +2067,11 @@ protected function getOperatorSQL(string $column, Operator $operator, array &$bi
20672067

20682068
case Operator::TYPE_ARRAY_REMOVE:
20692069
$removeValue = $values[0] ?? null;
2070-
$removeValue = is_array($removeValue) ? json_encode($removeValue) : $removeValue;
2070+
// Cast scalars to string so the value binds as PDO::PARAM_STR, preserving the
2071+
// pre-refactor behavior (it was bound with an explicit PARAM_STR). JSON_TABLE
2072+
// extracts `value` as TEXT, so the search term must compare as text — without
2073+
// the cast, getPDOType() would bind a number as PARAM_INT. Do not drop it.
2074+
$removeValue = is_array($removeValue) ? json_encode($removeValue) : (string)$removeValue;
20712075
$bindKey = $this->registerOperatorBind($binds, $removeValue);
20722076
return "{$quotedColumn} = IFNULL((
20732077
SELECT JSON_ARRAYAGG(value)

src/Database/Adapter/SQLite.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2169,7 +2169,10 @@ protected function getOperatorSQL(string $column, Operator $operator, array &$bi
21692169
case Operator::TYPE_ARRAY_REMOVE:
21702170
$values = $operator->getValues();
21712171
$removeValue = $values[0] ?? null;
2172-
$removeValue = is_array($removeValue) ? json_encode($removeValue) : $removeValue;
2172+
// Cast scalars to string so the value binds as PDO::PARAM_STR, preserving the
2173+
// pre-refactor behavior (it was bound with an explicit PARAM_STR). Without the
2174+
// cast, getPDOType() would bind a number as PARAM_INT. Do not drop it.
2175+
$removeValue = is_array($removeValue) ? json_encode($removeValue) : (string)$removeValue;
21732176
$bindKey = $this->registerOperatorBind($binds, $removeValue);
21742177
// SQLite: remove specific value from array
21752178
return "{$quotedColumn} = (

0 commit comments

Comments
 (0)