Make WordPress Core


Ignore:
Timestamp:
07/25/2024 04:33:50 PM (23 months ago)
Author:
jorbin
Message:

Filesystem: Normalize allowed_files so comparison is apples to apples.

In [58470] a change was made to normalize the filename in validate_file, however this leads to instances where the list of files that are allowed aren't normalized such as in the theme editor. By normalizing the array, the comparison is apples to apples.

Reviewed by hellofromTonya.
Merges 58570 to the 6.5 branch.

Fixes #61488.
Props jorbin, hellofromtonya, swissspidy, misulicus, script2see, Presskopp, audrasjb, peterwilsoncc, siliconforks, littler.chicken, paulkevan,

Location:
branches/6.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.5

  • branches/6.5/src/wp-includes/functions.php

    r58474 r58808  
    61936193    }
    61946194
    6195     // Normalize path for Windows servers
     6195    // Normalize path for Windows servers.
    61966196    $file = wp_normalize_path( $file );
     6197    // Normalize path for $allowed_files as well so it's an apples to apples comparison.
     6198    $allowed_files = array_map( 'wp_normalize_path', $allowed_files );
    61976199
    61986200    // `../` on its own is not allowed:
Note: See TracChangeset for help on using the changeset viewer.