Fix Uncaught TypeError count(NULL) for php8+ in Marketing.php (https://github.com/woocommerce/woocommerce-admin/pull/8213)
* Fix Uncaught TypeError count(NULL) for php8+ in Marketing.php * Add changelog
This commit is contained in:
parent
bfa445f600
commit
8281eac885
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: Fix
|
||||||
|
|
||||||
|
Fix Uncaught TypeError count(NULL) for php8+ in Marketing.php. #8213
|
|
@ -265,8 +265,7 @@ class Marketing {
|
||||||
'author_avatar' => isset( $raw_post['author_avatar_url'] ) ? $raw_post['author_avatar_url'] : '',
|
'author_avatar' => isset( $raw_post['author_avatar_url'] ) ? $raw_post['author_avatar_url'] : '',
|
||||||
];
|
];
|
||||||
|
|
||||||
$featured_media = $raw_post['_embedded']['wp:featuredmedia'];
|
$featured_media = $raw_post['_embedded']['wp:featuredmedia'] ?? [];
|
||||||
|
|
||||||
if ( count( $featured_media ) > 0 ) {
|
if ( count( $featured_media ) > 0 ) {
|
||||||
$image = current( $featured_media );
|
$image = current( $featured_media );
|
||||||
$post['image'] = add_query_arg(
|
$post['image'] = add_query_arg(
|
||||||
|
|
Loading…
Reference in New Issue