Skip to content

Commit c568871

Browse files
committed
Account for $meta arg in wp_prepare_attachment_for_js not being an array
1 parent f5f50f9 commit c568871

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

plugins/dominant-color-images/hooks.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,18 @@ function dominant_color_admin_script(): void {
251251
*
252252
* @since n.e.x.t
253253
*
254-
* @param array<mixed>|mixed $response The current response array for the attachment.
255-
* @param WP_Post $attachment The attachment post object.
256-
* @param array<mixed> $meta The attachment metadata.
257-
* @return array<mixed> The modified response array with added dominant color and transparency information.
254+
* @param array<string, mixed>|mixed $response The current response array for the attachment.
255+
* @param WP_Post $attachment The attachment post object.
256+
* @param array<string, mixed>|false $meta The attachment metadata.
257+
* @return array<string, mixed> The modified response array with added dominant color and transparency information.
258258
*/
259-
function dominant_color_prepare_attachment_for_js( $response, WP_Post $attachment, array $meta ): array {
259+
function dominant_color_prepare_attachment_for_js( $response, WP_Post $attachment, $meta ): array {
260260
if ( ! is_array( $response ) ) {
261261
$response = array();
262262
}
263+
if ( ! is_array( $meta ) ) {
264+
return $response;
265+
}
263266

264267
$response['dominantColor'] = '';
265268
if (

0 commit comments

Comments
 (0)