Commit ad1eed81c4 for wordpress.org
commit ad1eed81c43f7cf6270a8f3c8651730944bd7ab5
Author: jorbin <jorbin@git.wordpress.org>
Date: Tue Oct 6 14:47:53 2026 +0000
HTTP: Improve relative path resolution in `WP_Http::make_absolute_url()`.
Props jonsurrell, vortfu, xknown.
Built from https://develop.svn.wordpress.org/trunk@64127
git-svn-id: http://core.svn.wordpress.org/trunk@63283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/class-wp-http.php b/wp-includes/class-wp-http.php
index 13b82d95bf..eab634e644 100644
--- a/wp-includes/class-wp-http.php
+++ b/wp-includes/class-wp-http.php
@@ -1024,7 +1024,10 @@ class WP_Http {
// Strip all /path/../ out of the path.
while ( strpos( $path, '../' ) > 1 ) {
- $path = preg_replace( '![^/]+/\.\./!', '', $path );
+ $path = preg_replace( '![^/]+/\.\./!', '', $path, -1, $segment_replacement_count );
+ if ( 0 === $segment_replacement_count ) {
+ break;
+ }
}
// Strip any final leading ../ from the path.
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 4174ea0f4f..7951070c07 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-64126';
+$wp_version = '7.2-alpha-64127';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.