WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/01/2019 08:57:26 PM (6 months ago)
Author:
jorbin
Message:

Replace usages of basename() with wp_basename() in order to support multibyte filenames

This is focused on the pieces of code that touch media files and the tests that support them. basename isn't multibyte compatible out of the box. See http://php.net/basename and https://bugs.php.net/bug.php?id=62119.

See #43170.
Props Viper007Bond.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r44777 r44785  
    36523652
    36533653            $parent_url = wp_get_attachment_url( $attachment_id );
    3654             $url        = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url );
     3654            $url        = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url );
    36553655
    36563656            $size       = @getimagesize( $cropped );
     
    36583658
    36593659            $object = array(
    3660                 'post_title'     => basename( $cropped ),
     3660                'post_title'     => wp_basename( $cropped ),
    36613661                'post_content'   => $url,
    36623662                'post_mime_type' => $image_type,
Note: See TracChangeset for help on using the changeset viewer.