Opened 10 years ago
Closed 10 years ago
#28208 closed defect (bug) (fixed)
in wp_handle_upload setting the overwrite `test_upload` to false won't work for move_uploaded_file
Reported by: | bassjobsen | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | normal | Version: | 3.9.1 |
Component: | Upload | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
move_uploaded_file()
also checks is_uploaded_file
so if you skip is_uploaded_file
by setting test_upload
to false you can still upload your file cause move_uploaded_file() blocks it.
Possible solution
replace
if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) {
with:
if ( (false === $test_upload && false === @ rename( $file['tmp_name'], $new_file )) || false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) {
Attachments (1)
Change History (5)
This ticket was mentioned in Slack in #core by wonderboymusic. View the logs.
10 years ago
Note: See
TracTickets for help on using
tickets.
$test_upload
is useless and just causes errors later in the function if the check is skipped. I suggest 28208.diff