Make WordPress Core

Opened 17 years ago

Closed 16 years ago

#6427 closed defect (bug) (duplicate)

Behaviour changes in wp_unique_filename()

Reported by: tellyworth's profile tellyworth Owned by:
Milestone: Priority: normal
Severity: minor Version: 2.5
Component: Upload Keywords: has-patch
Focuses: Cc:

Description

Unit testing picked up two recent changes in wp_unique_filename() behaviour. They might be ok but I thought worth raising as they might affect plugins or l10n.

  1. The strtolower() introduced in [7478] mangles non-ascii filename characters on many systems. The locale isn't set so accented characters get converted to something unpredictable. This changes the result of the 'tést-imagé.png' case in test_wp_unique_filename():
expected string <testtest-image.png>
difference      <     xxxxxxxxx>
got string      <testtast-imaga.png>

http://svn.automattic.com/wordpress-tests/wp-testcase/test_includes_functions.php

  1. Leading paths aren't stripped from the filename if present. They were before [7440]. Now, the full path is used with slashes removed (i.e. /path/to/filename.jpg becomes pathtofilename.jpg instead of filename.jpg) test_unique_filename_with_slashes() now fails as a result:

http://svn.automattic.com/wordpress-tests/wp-testcase/test_includes_file.php

expected string <73bd23e4df5b4cbf9962bb1f4ee8988d.txt>
difference      <                                xxxx????????????????????????????????>
got string      <73bd23e4df5b4cbf9962bb1f4ee8988d73bd23e4df5b4cbf9962bb1f4ee8988d.txt>

It might be reasonable to accept the new behviour - if that's the case I'll update the tests to reflect that. If not, the enclosed patch fixes both issues and restores the previous behaviour. All relevant unit tests pass with the patch applied.

Attachments (1)

wp-unique-filename-behaviour-changes-r7553.patch (879 bytes) - added by tellyworth 17 years ago.

Download all attachments as: .zip

Change History (7)

#1 @lloydbudd
17 years ago

  • Milestone changed from 2.7 to 2.5

#2 @Denis-de-Bernardy
16 years ago

  • Keywords dev-feedback added

marking as dev-feedback to raise this.

please close if it rings no bell.

#3 @Denis-de-Bernardy
16 years ago

  • Keywords 2nd-opinion added

#5 @Denis-de-Bernardy
16 years ago

  • Keywords dev-feedback 2nd-opinion removed

#6 @Denis-de-Bernardy
16 years ago

  • Component changed from General to Upload
  • Milestone 2.9 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

dup/fixed.

Note: See TracTickets for help on using tickets.