[wp-trac] [WordPress Trac] #45960: plugin_basename() fails on windows path

WordPress Trac noreply at wordpress.org
Sat Jan 12 16:14:11 UTC 2019


#45960: plugin_basename() fails on windows path
--------------------------+-----------------------------
 Reporter:  dovyp         |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I happened upon this little bug with plugin_basename(). Namely if a file
 path include the C: (Windows), it will fail. So here's a quick fix.

 {{{#!php
 <?php
 if ( substr( strtoupper($file), 0, 2 ) === "C:" ) {
         $file = ltrim($file, 'C:');
         $file = ltrim($file, 'c:');
 }
 }}}


 If we add this as initial sterilization, it will work as expected.
 Otherwise, the wrong string is returned.

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


More information about the wp-trac mailing list