From 91b119eefd001b857ce645cb631fae9de19e62d4 Mon Sep 17 00:00:00 2001 From: catch <6915-catch@users.noreply.drupalcode.org> Date: Tue, 15 Apr 2025 01:51:25 +0100 Subject: [PATCH] Issue #3511966 by tom konda: Replace RegExp with str_ends_with() in .ht.router.php --- .ht.router.php | 2 +- core/assets/scaffold/files/ht.router.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ht.router.php b/.ht.router.php index b5884ef4a9d0..97c517f0ca26 100644 --- a/.ht.router.php +++ b/.ht.router.php @@ -44,7 +44,7 @@ // fallback to index.php. do { $path = dirname($path); - if (preg_match('/\.php$/', $path) && is_file(__DIR__ . $path)) { + if (str_ends_with($path, '.php') && is_file(__DIR__ . $path)) { // Discovered that the path contains an existing PHP file. Use that as the // script to include. $script = ltrim($path, '/'); diff --git a/core/assets/scaffold/files/ht.router.php b/core/assets/scaffold/files/ht.router.php index b5884ef4a9d0..97c517f0ca26 100644 --- a/core/assets/scaffold/files/ht.router.php +++ b/core/assets/scaffold/files/ht.router.php @@ -44,7 +44,7 @@ // fallback to index.php. do { $path = dirname($path); - if (preg_match('/\.php$/', $path) && is_file(__DIR__ . $path)) { + if (str_ends_with($path, '.php') && is_file(__DIR__ . $path)) { // Discovered that the path contains an existing PHP file. Use that as the // script to include. $script = ltrim($path, '/'); -- GitLab