From d8a40cc4e62bd1abee2798e1da73296b9759d21f Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 21 Feb 2026 23:37:32 +0800 Subject: [PATCH 1/2] refactor: remove case-insensitive comparison for HTTP methods in `FilterCollector` --- .../Utilities/Routes/FilterCollector.php | 44 +++---------------- .../Utilities/Routes/FilterCollectorTest.php | 8 +--- user_guide_src/source/changelogs/v4.8.0.rst | 3 ++ 3 files changed, 10 insertions(+), 45 deletions(-) diff --git a/system/Commands/Utilities/Routes/FilterCollector.php b/system/Commands/Utilities/Routes/FilterCollector.php index ec1219debe1a..98963bba7d74 100644 --- a/system/Commands/Utilities/Routes/FilterCollector.php +++ b/system/Commands/Utilities/Routes/FilterCollector.php @@ -37,7 +37,8 @@ public function __construct( } /** - * Returns filters for the URI + * Returns filters for the URI based on the HTTP method. + * The HTTP method is compared case-sensitively. * * @param string $method HTTP verb like `GET`,`POST` or `CLI`. * @param string $uri URI path to find filters for @@ -46,25 +47,8 @@ public function __construct( */ public function get(string $method, string $uri): array { - if ($method === strtolower($method)) { - @trigger_error( - 'Passing lowercase HTTP method "' . $method . '" is deprecated.' - . ' Use uppercase HTTP method like "' . strtoupper($method) . '".', - E_USER_DEPRECATED, - ); - } - - /** - * @deprecated 4.5.0 - * @TODO Remove this in the future. - */ - $method = strtoupper($method); - if ($method === 'CLI') { - return [ - 'before' => [], - 'after' => [], - ]; + return ['before' => [], 'after' => []]; } $request = service('incomingrequest', null, false); @@ -79,7 +63,8 @@ public function get(string $method, string $uri): array } /** - * Returns filter classes for the URI + * Returns filter classes for the URI based on the HTTP method. + * The HTTP method is compared case-sensitively. * * @param string $method HTTP verb like `GET`,`POST` or `CLI`. * @param string $uri URI path to find filters for @@ -88,25 +73,8 @@ public function get(string $method, string $uri): array */ public function getClasses(string $method, string $uri): array { - if ($method === strtolower($method)) { - @trigger_error( - 'Passing lowercase HTTP method "' . $method . '" is deprecated.' - . ' Use uppercase HTTP method like "' . strtoupper($method) . '".', - E_USER_DEPRECATED, - ); - } - - /** - * @deprecated 4.5.0 - * @TODO Remove this in the future. - */ - $method = strtoupper($method); - if ($method === 'CLI') { - return [ - 'before' => [], - 'after' => [], - ]; + return ['before' => [], 'after' => []]; } $request = service('incomingrequest', null, false); diff --git a/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php b/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php index fb6c0e5e8ebd..c6789c6e43f4 100644 --- a/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php @@ -34,12 +34,6 @@ public function testGet(): void $filters = $collector->get(Method::GET, '/'); - $expected = [ - 'before' => [ - ], - 'after' => [ - ], - ]; - $this->assertSame($expected, $filters); + $this->assertSame(['before' => [], 'after' => []], $filters); } } diff --git a/user_guide_src/source/changelogs/v4.8.0.rst b/user_guide_src/source/changelogs/v4.8.0.rst index 135f620e31fd..f367718bb31b 100644 --- a/user_guide_src/source/changelogs/v4.8.0.rst +++ b/user_guide_src/source/changelogs/v4.8.0.rst @@ -23,6 +23,9 @@ BREAKING Behavior Changes ================ +- **Commands:** The ``get()`` and ``getClasses()`` methods of ``FilterCollector`` now compare the HTTP method case-sensitively. + This may affect filters defined for methods like `get`, `post`, etc., which should be updated to uppercase (e.g., `GET`, `POST`) to ensure they are applied correctly. + Interface Changes ================= From 3d69bd6715bc415bd31fedc52c8950603f387565 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sun, 22 Feb 2026 02:06:32 +0800 Subject: [PATCH 2/2] Fix changelog entry Co-authored-by: michalsn --- user_guide_src/source/changelogs/v4.8.0.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/user_guide_src/source/changelogs/v4.8.0.rst b/user_guide_src/source/changelogs/v4.8.0.rst index f367718bb31b..277c755b5e6e 100644 --- a/user_guide_src/source/changelogs/v4.8.0.rst +++ b/user_guide_src/source/changelogs/v4.8.0.rst @@ -23,8 +23,7 @@ BREAKING Behavior Changes ================ -- **Commands:** The ``get()`` and ``getClasses()`` methods of ``FilterCollector`` now compare the HTTP method case-sensitively. - This may affect filters defined for methods like `get`, `post`, etc., which should be updated to uppercase (e.g., `GET`, `POST`) to ensure they are applied correctly. +- **Commands:** The ``filter:check`` command now requires the HTTP method argument to be uppercase (e.g., ``spark filter:check GET /`` instead of ``spark filter:check get /``). Interface Changes =================