WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] function wp_basename is wrong in windows (4 posts)

  1. xu-lihui
    Member
    Posted 2 years ago #

    Hi.I find a bug.
    In /wp-includes/media.php about line 441.
    The code is:
    $info = pathinfo($file);
    $dir = $info['dirname'];
    $ext = $info['extension'];
    $name = wp_basename($file, ".$ext");`

    In my works the $file values :
    $file = 'D:\wwwroot\9thq-main/wp-content\uploads\slideshow-gallery5.jpg';
    But the result of $name is : 'wp-content\uploads\slideshow-gallery5'
    It is not true!

    In my tests, I find that the function wp_basename() is not works very well.
    The code is:
    basename( str_replace( '%2F', '/', urlencode( $path ) )
    It only tranforms '/' but miss the '\';
    It neglects the symbol of the path in windows;

  2. MikeHarris
    Member
    Posted 2 years ago #

    Agreed. I have just noticed the same issue

  3. sebber
    Member
    Posted 1 year ago #

    Could anyone create a Bug? My Reported Bug was deleted, i don't know why...

  4. sebber
    Member
    Posted 1 year ago #

    Know i put it in the Bugtracker ... maybe own fault ;-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.