[wp-trac] [WordPress Trac] #6427: Behaviour changes in
wp_unique_filename()
WordPress Trac
wp-trac at lists.automattic.com
Thu Mar 27 21:55:28 GMT 2008
#6427: Behaviour changes in wp_unique_filename()
------------------------+---------------------------------------------------
Reporter: tellyworth | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.7
Component: General | Version: 2.5
Severity: minor | Keywords: has-patch
------------------------+---------------------------------------------------
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
2. 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.
--
Ticket URL: <http://trac.wordpress.org/ticket/6427>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list