Skip to content

Commit 4a90f26

Browse files
committed
General: Correct path replacement regex in wp_guess_url.
In `wp_guess_url`, the regex to check for wp-login.php in the URL is slightly too permissive, not escaping `.` in "wp-login.php". `.` is a token in regex that matches any character. This change simply escapes the `.` and adds unit test coverage for `wp_guess_url`. Props cfinke, ocean90, jrf, voldemortensen, jdgrimes, curdin, netweb, petitphp, SergeyBiryukov, costdev. Fixes #36827. Built from https://develop.svn.wordpress.org/trunk@54146 git-svn-id: https://core.svn.wordpress.org/trunk@53705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 55a2dc4 commit 4a90f26

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

wp-includes/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6033,7 +6033,7 @@ function wp_guess_url() {
60336033

60346034
// The request is for the admin.
60356035
if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false ) {
6036-
$path = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI'] );
6036+
$path = preg_replace( '#/(wp-admin/?.*|wp-login\.php.*)#i', '', $_SERVER['REQUEST_URI'] );
60376037

60386038
// The request is for a file in ABSPATH.
60396039
} elseif ( $script_filename_dir . '/' === $abspath_fix ) {

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '6.1-alpha-54145';
19+
$wp_version = '6.1-alpha-54146';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)