Skip to content

Commit d355d59

Browse files
committed
SqlPreprocessor::formatValue() rejects array unless they are explicitly allowed (possible BC break)
1 parent 08789fa commit d355d59

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Database/SqlPreprocessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ private function formatValue($value, string $mode = null): string
194194
$value = iterator_to_array($value);
195195
}
196196

197-
if (is_array($value)) {
197+
if ($mode && is_array($value)) {
198198
$vx = $kx = [];
199199
if ($mode === self::MODE_AUTO) {
200200
$mode = $this->arrayMode;
@@ -230,7 +230,7 @@ private function formatValue($value, string $mode = null): string
230230
foreach ($value as $k => $v) {
231231
if (is_int($k)) { // value, value, ... OR (1, 2), (3, 4)
232232
$vx[] = is_array($v)
233-
? '(' . $this->formatValue($v) . ')'
233+
? '(' . $this->formatValue($v, self::MODE_LIST) . ')'
234234
: $this->formatValue($v);
235235
} elseif (substr($k, -1) === '=') { // key+=value, key-=value, ...
236236
$k2 = $this->delimite(substr($k, 0, -2));
@@ -259,7 +259,7 @@ private function formatValue($value, string $mode = null): string
259259
$k = $this->delimite($k);
260260
if (is_array($v)) {
261261
if ($v) {
262-
$vx[] = $k . ' ' . ($operator ? $operator . ' ' : '') . 'IN (' . $this->formatValue(array_values($v)) . ')';
262+
$vx[] = $k . ' ' . ($operator ? $operator . ' ' : '') . 'IN (' . $this->formatValue(array_values($v), self::MODE_LIST) . ')';
263263
} elseif ($operator === 'NOT') {
264264
} else {
265265
$vx[] = '1=0';

0 commit comments

Comments
 (0)