Changeset 34104
- Timestamp:
- 09/14/2015 01:58:03 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r34059 r34104 1576 1576 * Normalize a filesystem path. 1577 1577 * 1578 * Replaces backslashes with forward slashes for Windows systems, and ensures 1579 * no duplicate slashes exist. 1578 * On windows systems, replaces backslashes with forward slashes 1579 * and forces upper-case drive letters. 1580 * Ensures that no duplicate slashes exist. 1580 1581 * 1581 1582 * @since 3.9.0 1583 * @since 4.4.0 Ensures upper-case drive letters on Windows systems. 1582 1584 * 1583 1585 * @param string $path Path to normalize. … … 1587 1589 $path = str_replace( '\\', '/', $path ); 1588 1590 $path = preg_replace( '|/+|','/', $path ); 1591 if ( ':' === substr( $path, 1, 1 ) ) { 1592 $path = ucfirst( $path ); 1593 } 1589 1594 return $path; 1590 1595 } -
trunk/tests/phpunit/tests/functions.php
r32631 r34104 112 112 foreach ($relative_paths as $path) 113 113 $this->assertFalse( path_is_absolute($path), "path_is_absolute('$path') should return false" ); 114 } 115 116 /** 117 * @ticket 33265 118 */ 119 function test_wp_normalize_path() { 120 $paths = array( 121 '/WINDOWS' => '/WINDOWS', 122 'C:/' => 'C:/', 123 'C:/WINDOWS' => 'C:/WINDOWS', 124 'C:/WINDOWS/system32' => 'C:/WINDOWS/system32', 125 '\\WINDOWS' => '/WINDOWS', 126 'C:\\' => 'C:/', 127 'C:\\WINDOWS' => 'C:/WINDOWS', 128 'C:\\\\WINDOWS' => 'C:/WINDOWS', 129 'C:\\WINDOWS\\system32' => 'C:/WINDOWS/system32', 130 '\\\\sambashare\\foo' => '/sambashare/foo', 131 'c:/windows' => 'C:/windows', 132 'c:\\windows' => 'C:/windows', 133 ); 134 135 foreach ($paths as $original => $expected) { 136 $this->assertEquals( $expected, wp_normalize_path( $original ) ); 137 } 114 138 } 115 139
Note: See TracChangeset
for help on using the changeset viewer.