From b83c97025fb57b9a45392364fe91961f570aedf9 Mon Sep 17 00:00:00 2001 From: Adrian Jagusch Date: Mon, 5 May 2025 15:12:46 +0200 Subject: [PATCH 1/2] Fixing PHP warning: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated --- src/Http/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http/Router.php b/src/Http/Router.php index 95f967b..bb191fd 100644 --- a/src/Http/Router.php +++ b/src/Http/Router.php @@ -63,7 +63,7 @@ private function get_current_route(): string { // Requested URI relative to WP install. $uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; - $uri = str_replace( $installed_dir, '', $uri ); + $uri = $installed_dir ? str_replace( $installed_dir, '', $uri ) : $uri; $route = strtok( $uri, '?' ); From 125c690abb78f7743c1598f4a35d6e84e641fbf2 Mon Sep 17 00:00:00 2001 From: Adrian Jagusch Date: Mon, 5 May 2025 15:13:40 +0200 Subject: [PATCH 2/2] Fixing indentation --- src/Http/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http/Router.php b/src/Http/Router.php index bb191fd..e97cb9a 100644 --- a/src/Http/Router.php +++ b/src/Http/Router.php @@ -63,7 +63,7 @@ private function get_current_route(): string { // Requested URI relative to WP install. $uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; - $uri = $installed_dir ? str_replace( $installed_dir, '', $uri ) : $uri; + $uri = $installed_dir ? str_replace( $installed_dir, '', $uri ) : $uri; $route = strtok( $uri, '?' );