From c1e9ce6aaa2d1b98c2b94cb2684c809bd2657b75 Mon Sep 17 00:00:00 2001 From: Justin Frydman Date: Mon, 9 Feb 2026 11:30:51 -0700 Subject: [PATCH 1/2] KAD-5434: bump superglobals to 2.0 to get proper fallback working --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index fc01e7401..45d33bd57 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ "stellarwp/prophecy-image-downloader": "^3.0", "stellarwp/prophecy-storage": "^3.0", "stellarwp/schema": "^2.0", - "stellarwp/superglobals": "^1.3", + "stellarwp/superglobals": "^2.0", "stellarwp/telemetry": "^2.3", "stellarwp/uplink": "dev-bugfix/multisite-token-logic", "symfony/translation-contracts": "^2.5" diff --git a/composer.lock b/composer.lock index 77382173e..093b93597 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7a823630fd7197034de879f12f7ac260", + "content-hash": "71d610412ee70256b8492c277ea40194", "packages": [ { "name": "adbario/php-dot-notation", @@ -1009,16 +1009,16 @@ }, { "name": "stellarwp/superglobals", - "version": "1.3.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/stellarwp/superglobals.git", - "reference": "a43ffa491c171f46d81a26d55e096bc8eaddfb3e" + "reference": "188f4466663b9aea10cdb865805a734ecc9f0f25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stellarwp/superglobals/zipball/a43ffa491c171f46d81a26d55e096bc8eaddfb3e", - "reference": "a43ffa491c171f46d81a26d55e096bc8eaddfb3e", + "url": "https://api.github.com/repos/stellarwp/superglobals/zipball/188f4466663b9aea10cdb865805a734ecc9f0f25", + "reference": "188f4466663b9aea10cdb865805a734ecc9f0f25", "shasum": "" }, "require": { @@ -1053,9 +1053,9 @@ "description": "A library that handles access to superglobals.", "support": { "issues": "https://github.com/stellarwp/superglobals/issues", - "source": "https://github.com/stellarwp/superglobals/tree/1.3.0" + "source": "https://github.com/stellarwp/superglobals/tree/2.0.0" }, - "time": "2024-06-26T14:12:19+00:00" + "time": "2026-02-09T18:15:19+00:00" }, { "name": "stellarwp/telemetry", From bd6aca0f6da05cb213de0a261665a7452b36113f Mon Sep 17 00:00:00 2001 From: Justin Frydman Date: Mon, 9 Feb 2026 11:45:01 -0700 Subject: [PATCH 2/2] KAD-5434: Add failing test, simulate how SureCart was overriding globals with invalid values. --- .../Optimizer/Path/PathFactoryTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/wpunit/Resources/Optimizer/Path/PathFactoryTest.php b/tests/wpunit/Resources/Optimizer/Path/PathFactoryTest.php index d45ca77f1..3d61d4522 100644 --- a/tests/wpunit/Resources/Optimizer/Path/PathFactoryTest.php +++ b/tests/wpunit/Resources/Optimizer/Path/PathFactoryTest.php @@ -4,6 +4,7 @@ use InvalidArgumentException; use KadenceWP\KadenceBlocks\Optimizer\Path\Path_Factory; +use stdClass; use Tests\Support\Classes\OptimizerTestCase; final class PathFactoryTest extends OptimizerTestCase { @@ -19,6 +20,12 @@ protected function setUp(): void { $this->path_factory = $this->container->get( Path_Factory::class ); } + protected function tearDown(): void { + unset( $_SERVER['REQUEST_URI'] ); + + parent::tearDown(); + } + public function testItHandlesRootPath(): void { $_SERVER['REQUEST_URI'] = '/'; @@ -347,4 +354,16 @@ public function testItResolvesPostIdForPageForPosts(): void { $this->assertSame( '/blog/', $path->path() ); $this->assertSame( $blog_page_id, $path->post_id() ); } + + /** + * @note this would only fatal error in PHP 8.x + */ + public function testItHandlesInvalidRequestUri(): void { + $this->expectException( InvalidArgumentException::class ); + $this->expectExceptionMessage( 'Cannot hash an empty path. Verify you are using this after the wp hook fired.' ); + + $_SERVER['REQUEST_URI'] = new stdClass(); + + $this->path_factory->make(); + } }