Changeset 61857 for trunk/src/wp-includes/functions.php
- Timestamp:
- 03/06/2026 08:04:31 PM (2 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/functions.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r61710 r61857 2180 2180 * @since 4.5.0 Allows for Windows network shares. 2181 2181 * @since 4.9.7 Allows for PHP file wrappers. 2182 * @since 7.0.0 Uses a static cache to store normalized paths. 2182 2183 * 2183 2184 * @param string $path Path to normalize. 2184 2185 * @return string Normalized path. 2185 2186 */ 2186 function wp_normalize_path( $path ) { 2187 $wrapper = ''; 2187 function wp_normalize_path( $path ): string { 2188 $path = (string) $path; 2189 2190 static $cache = array(); 2191 if ( isset( $cache[ $path ] ) ) { 2192 return $cache[ $path ]; 2193 } 2194 2195 $original_path = $path; 2196 $wrapper = ''; 2188 2197 2189 2198 if ( wp_is_stream( $path ) ) { … … 2197 2206 2198 2207 // Replace multiple slashes down to a singular, allowing for network shares having two slashes. 2199 $path = preg_replace( '|(?<=.)/+|', '/', $path );2208 $path = (string) preg_replace( '|(?<=.)/+|', '/', $path ); 2200 2209 2201 2210 // Windows paths should uppercase the drive letter. … … 2204 2213 } 2205 2214 2206 return $wrapper . $path; 2215 $cache[ $original_path ] = $wrapper . $path; 2216 return $cache[ $original_path ]; 2207 2217 } 2208 2218
Note: See TracChangeset
for help on using the changeset viewer.