Check for array before calling array_key_exists
This commit is contained in:
parent
6c724ff81d
commit
77d2821347
@ -157,6 +157,9 @@ function get_object( $id ) {
|
||||
'not_found', __( 'Object not found', 'pterotype' ), array( 'status' => 404 )
|
||||
);
|
||||
}
|
||||
if ( is_array($object_json) && array_key_exists( 'object', $object_json ) ) {
|
||||
$object_json = \pterotype\util\decompact_object( $object_json, array( 'object' ) );
|
||||
}
|
||||
return json_decode( $object_json, true );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user