Make WordPress Core


Ignore:
Timestamp:
03/01/2019 08:57:26 PM (6 years 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/tests/phpunit/tests/image/editor.php

    r44577 r44785  
    131131
    132132        // Test with no parameters
    133         $this->assertEquals( 'canola-100x50.jpg', basename( $editor->generate_filename() ) );
     133        $this->assertEquals( 'canola-100x50.jpg', wp_basename( $editor->generate_filename() ) );
    134134
    135135        // Test with a suffix only
    136         $this->assertEquals( 'canola-new.jpg', basename( $editor->generate_filename( 'new' ) ) );
     136        $this->assertEquals( 'canola-new.jpg', wp_basename( $editor->generate_filename( 'new' ) ) );
    137137
    138138        // Test with a destination dir only
     
    140140
    141141        // Test with a suffix only
    142         $this->assertEquals( 'canola-100x50.png', basename( $editor->generate_filename( null, null, 'png' ) ) );
     142        $this->assertEquals( 'canola-100x50.png', wp_basename( $editor->generate_filename( null, null, 'png' ) ) );
    143143
    144144        // Combo!
Note: See TracChangeset for help on using the changeset viewer.