Fix the PHP warning in which the null was passed to json_decode (#50661)

* Fix the PHP warning in which the null was passed to json_decode

* Add changelog
This commit is contained in:
Karol Manijak 2024-08-14 11:13:37 +02:00 committed by GitHub
parent 381c87da80
commit f1be869ff4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
Product Collection: fix the PHP deprecated warning

View File

@ -226,7 +226,7 @@ class ProductCollection extends AbstractBlock {
'data-wc-navigation-id',
'wc-product-collection-' . $this->parsed_block['attrs']['queryId']
);
$current_context = json_decode( $p->get_attribute( 'data-wc-context' ), true ) ?? [];
$current_context = json_decode( $p->get_attribute( 'data-wc-context' ) ?? '{}', true );
$p->set_attribute(
'data-wc-context',
wp_json_encode(