Skip to content

Commit d984aee

Browse files
committed
type safe casting
1 parent e4d576e commit d984aee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Schema/Traits/Custom_Table_Query_Methods.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ public static function cast_value_based_on_type( string $type, $value ) {
800800
case Column::PHP_TYPE_BOOL:
801801
return (bool) $value;
802802
case Column::PHP_TYPE_JSON:
803-
return (array) json_decode( $value, true );
803+
return is_string( $value ) ? (array) json_decode( $value, true ) : (array) $value;
804804
case Column::PHP_TYPE_DATETIME:
805805
try {
806806
$instance = Config::get_container()->get( DateTimeInterface::class );

0 commit comments

Comments
 (0)