From caf9ec635ea5470c0cee390dca9f2aae3fdc7ec4 Mon Sep 17 00:00:00 2001 From: Christopher Allford <6451942+ObliviousHarmony@users.noreply.github.com> Date: Tue, 3 Sep 2024 09:54:22 -0700 Subject: [PATCH] Use PHP 7.4 for WooCommerce Blocks' `wp-env` Config (#51075) This resolves a PHP 7.4 compatibility problem as well as updates the `wp-env` config for the Blocks tests to use 7.4 rather than the latest. --- plugins/woocommerce-blocks/.wp-env.json | 1 + .../51075-fix-blocks-wp-env-php-version | 4 ++++ .../Blocks/BlockTypes/ProductCollection.php | 18 ++++++++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 plugins/woocommerce/changelog/51075-fix-blocks-wp-env-php-version diff --git a/plugins/woocommerce-blocks/.wp-env.json b/plugins/woocommerce-blocks/.wp-env.json index 096bfffd01a..49edf6823e2 100644 --- a/plugins/woocommerce-blocks/.wp-env.json +++ b/plugins/woocommerce-blocks/.wp-env.json @@ -1,5 +1,6 @@ { "core": null, + "phpVersion": "7.4", "plugins": [ "https://github.com/WP-API/Basic-Auth/archive/master.zip", "https://downloads.wordpress.org/plugin/wordpress-importer.0.8.zip", diff --git a/plugins/woocommerce/changelog/51075-fix-blocks-wp-env-php-version b/plugins/woocommerce/changelog/51075-fix-blocks-wp-env-php-version new file mode 100644 index 00000000000..f2a5f405565 --- /dev/null +++ b/plugins/woocommerce/changelog/51075-fix-blocks-wp-env-php-version @@ -0,0 +1,4 @@ +Significance: patch +Type: tweak +Comment: Just a change to the dev environment config. + diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php b/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php index f2f9f72328a..09fe61976fa 100644 --- a/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php +++ b/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php @@ -304,14 +304,16 @@ class ProductCollection extends AbstractBlock { $p->set_attribute( 'data-wc-context', wp_json_encode( - array( - ...$current_context, - // The message to be announced by the screen reader when the page is loading or loaded. - 'accessibilityLoadingMessage' => __( 'Loading page, please wait.', 'woocommerce' ), - 'accessibilityLoadedMessage' => __( 'Page Loaded.', 'woocommerce' ), - // We don't prefetch the links if user haven't clicked on pagination links yet. - // This way we avoid prefetching when the page loads. - 'isPrefetchNextOrPreviousLink' => false, + array_merge( + $current_context, + array( + // The message to be announced by the screen reader when the page is loading or loaded. + 'accessibilityLoadingMessage' => __( 'Loading page, please wait.', 'woocommerce' ), + 'accessibilityLoadedMessage' => __( 'Page Loaded.', 'woocommerce' ), + // We don't prefetch the links if user haven't clicked on pagination links yet. + // This way we avoid prefetching when the page loads. + 'isPrefetchNextOrPreviousLink' => false, + ), ), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP )