Changeset 53934
- Timestamp:
- 08/23/2022 07:57:17 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r53887 r53934 2084 2084 * 2085 2085 * @since 2.5.0 2086 * @since 6.1.0 Allows normalized Windows paths (forward slashes). 2086 2087 * 2087 2088 * @param string $path File path. … … 2111 2112 // Windows allows absolute paths like this. 2112 2113 if ( preg_match( '#^[a-zA-Z]:\\\\#', $path ) ) { 2114 return true; 2115 } 2116 2117 // Normalized Windows paths for local filesystem and network shares (forward slashes). 2118 if ( preg_match( '#(^[a-zA-Z]+:/|^//[\w!@\#\$%\^\(\)\-\'{}\.~]{1,15})#', $path ) ) { 2113 2119 return true; 2114 2120 } -
trunk/src/wp-includes/post.php
r53883 r53934 725 725 726 726 // If the file is relative, prepend upload dir. 727 if ( $file && 0 !== strpos( $file, '/' ) && ! preg_match( '|^.:\\\|', $file )) {727 if ( $file ) { 728 728 $uploads = wp_get_upload_dir(); 729 729 730 if ( false === $uploads['error'] ) { 730 $file = $uploads['basedir'] . "/$file";731 $file = path_join( $uploads['basedir'], $file ); 731 732 } 732 733 } -
trunk/tests/phpunit/tests/functions.php
r53890 r53934 106 106 'C:\\WINDOWS', 107 107 '\\\\sambashare\\foo', 108 'c:/', 109 'c://', 110 '//', 111 'c:/FOO', 112 '//FOO', 113 'C:/WWW/Sites/demo/htdocs/wordpress/wp-content/uploads/2016/03/example.jpg', 114 '//ComputerName/ShareName/SubfolderName/example.txt', 108 115 ); 109 116 foreach ( $absolute_paths as $path ) { … … 120 127 '../', 121 128 '../foo.bar', 129 'foo.bar', 122 130 'foo/bar', 123 131 'foo', 124 132 'FOO', 125 133 '..\\WINDOWS', 134 '..//WINDOWS', 135 'c:', 136 'C:', 126 137 ); 127 138 foreach ( $relative_paths as $path ) {
Note: See TracChangeset
for help on using the changeset viewer.