Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Util_Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ public static function document_root() {

if ( $docroot_fix ) {
$document_root = untrailingslashit( ABSPATH );
$document_root = self::normalize_path( $document_root );
return $document_root;
}

Expand All @@ -756,6 +757,7 @@ public static function document_root() {
if ( substr( $script_filename, -strlen( $php_self ) ) === $php_self ) {
$document_root = substr( $script_filename, 0, -strlen( $php_self ) );
$document_root = realpath( $document_root );
$document_root = self::normalize_path( $document_root );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CDN path stripping breaks on Windows

Medium Severity

document_root() now always returns a forward-slash path after realpath(), which fixes Page Cache comparisons, but several CDN callers still str_replace that value against OS-native paths such as WP_CONTENT_DIR and upload basedir without normalizing the other side. On Windows those prefixes no longer match, so folder-placeholder and relative-path stripping can leave absolute paths in place.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 14aadad. Configure here.

return $document_root;
}
}
Expand All @@ -773,6 +775,7 @@ public static function document_root() {
}

$document_root = realpath( $document_root );
$document_root = self::normalize_path( $document_root );
return $document_root;
}

Expand Down