[wp-trac] [WordPress Trac] #48975: Fix unhandled upper/lower case change in wp_unique_filename()
WordPress Trac
noreply at wordpress.org
Tue Dec 17 00:10:08 UTC 2019
#48975: Fix unhandled upper/lower case change in wp_unique_filename()
-------------------------------------------------+-------------------------
Reporter: azaozz | Owner: azaozz
Type: defect (bug) | Status: reopened
Priority: high | Milestone: 5.3.2
Component: Upload | Version: 5.3.1
Severity: major | Resolution:
Keywords: has-patch 2nd-opinion has-unit- | Focuses:
tests fixed-major |
-------------------------------------------------+-------------------------
Comment (by pbiron):
I just had a look at the latest patch and have a couple of questions
(sorry I didn't get to this until after you committed it):
1. checking that it hasn't gone through the last `while()` loop more times
than there are files in the directory seems like a sensible safe guard.
However, if it does hit that limit then the filename is returned as it is
at that point...which means that there would (could?) still be a conflict.
I don't have any suggestions off the top of my my head for how to address
that, but wanted to mention it.
2. should we add add unit tests that specifically test for that case (and
the one #48960)?
3. similarly, the last 2 assertions in
`test_unique_filename_with_dimension_like_filename()` have a comment that
certain files should exist is `DIR_TESTDATA . '/images/'` for them to
actually test what they are intended to test. I think it would be good if
there were assertions to test that (instead of just the comment)...just in
case (e.g., `$this->assertTrue( file_exists( "{$testdir}one-blue-pixel-
100x100.png"); $this->assertTrue( file_exists( "{$testdir}one-blue-
pixel-1-100x100.png");`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48975#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list