Skip to content

Commit e530895

Browse files
committed
trying to handle empty arrays
1 parent f6020f3 commit e530895

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Schema/Traits/Custom_Table_Query_Methods.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,10 @@ private static function prepare_value_for_query( string $column, $value ): array
803803
throw new InvalidArgumentException( "Unsupported column type: $column_type." );
804804
}
805805

806+
if ( is_array( $value ) && empty( $value ) ) {
807+
return [ null, '(NULL)' ];
808+
}
809+
806810
// @phpstan-ignore-next-line
807811
return [ $value, is_array( $value ) ? '(' . implode( ',', array_fill( 0, count( $value ), $placeholder ) ) . ')' : $placeholder ];
808812
}

0 commit comments

Comments
 (0)