[wp-trac] [WordPress Trac] #46561: Make wp_nomralize_path() on Windows resolve drive letter for drive–relative paths

WordPress Trac noreply at wordpress.org
Tue Mar 19 09:18:48 UTC 2019


#46561: Make wp_nomralize_path() on Windows resolve drive letter for drive–relative
paths
-------------------------+-----------------------------
 Reporter:  Rarst        |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  minor        |   Keywords:  needs-patch
  Focuses:               |
-------------------------+-----------------------------
 Though rarely used, Windows allows to omit drive letter in file path to
 treat is as drive–relative.

 This causes inconsistency where paths pointing to the same dir are not
 normalized to the same representation by `wp_normalize_path()`:

 {{{#!php
 <?php
 var_dump( wp_normalize_path( 'C:\server\www\dev' ) );
 // "C:/server/www/dev

 var_dump( wp_normalize_path( '\server\www\dev' ) );
 // /server/www/dev << same path, but mismatch after normalize

 var_dump( wp_normalize_path( realpath( '\server\www\dev' ) ) );
 // C:/server/www/dev << resolved drive letter before normalize
 }}}

 I think drive letter should be explicitly resolved as part of
 normalization for this case.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46561>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list