Skip to content

Commit d01b131

Browse files
committed
include nulls
1 parent 1103b8d commit d01b131

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Schema/Traits/Custom_Table_Query_Methods.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,13 +945,13 @@ public static function cast_value_based_on_type( string $type, $value ) {
945945
* @return array<null|string|int|float|bool|DateTimeInterface> The value as an array.
946946
*/
947947
private static function ensure_array( $value ): array {
948-
if ( ! is_int( $value ) && ! is_string( $value ) && ! is_float( $value ) && ! is_bool( $value ) && ! $value instanceof DateTimeInterface && ! is_array( $value ) ) {
948+
if ( null !== $value && ! is_int( $value ) && ! is_string( $value ) && ! is_float( $value ) && ! is_bool( $value ) && ! $value instanceof DateTimeInterface && ! is_array( $value ) ) {
949949
throw new InvalidArgumentException( 'Value should be an integer, string, float, boolean, DateTimeInterface, or array.' );
950950
}
951951

952952
if ( is_array( $value ) && $value ) {
953953
foreach ( $value as $v ) {
954-
if ( ! is_int( $v ) && ! is_string( $v ) && ! is_float( $v ) && ! is_bool( $v ) && ! $v instanceof DateTimeInterface ) {
954+
if ( null !== $v && ! is_int( $v ) && ! is_string( $v ) && ! is_float( $v ) && ! is_bool( $v ) && ! $v instanceof DateTimeInterface ) {
955955
throw new InvalidArgumentException( 'Offset of value should be an integer, string, float, boolean or DateTimeInterface.' );
956956
}
957957
}

0 commit comments

Comments
 (0)