return empty array when passing empty as SQLvalue

pull/3621/head
Isaac Connor 2022-09-27 14:40:13 -04:00
parent 73c2415f83
commit 837d0ece7f
1 changed files with 7 additions and 3 deletions

View File

@ -98,9 +98,13 @@ class ZM_Object {
if ( $value == null ) {
$fields[] = '`'.$field.'` IS NULL';
} else if ( is_array($value) ) {
$func = function(){return '?';};
$fields[] = '`'.$field.'` IN ('.implode(',', array_map($func, $value)). ')';
$values += $value;
if ( count($value) ) {
$func = function(){return '?';};
$fields[] = '`'.$field.'` IN ('.implode(',', array_map($func, $value)). ')';
$values += $value;
} else {
return array();
}
} else {
$fields[] = '`'.$field.'`=?';