WordPress.org

Make WordPress Core

Opened 14 months ago

Last modified 3 months ago

#38119 new defect (bug)

File is not getting uploaded if the error field in $uploads array is blank

Reported by: PranaliPatel Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6.1
Component: Upload Keywords: has-patch close
Focuses: Cc:

Description

Hello,

$uploads variable ( at wordpress/wp-admin/includes/file.php - line number - 364) contains below array values when user uploads the file.

Array (
        [path] => /path/to/your/file
        [url] => /url
        [subdir] => /2010/05
        [basedir] => /path/to/wordpress/wp-content/uploads
        [baseurl] => http://example.com/wp-content/uploads
        [error] =>
    )

If the [error] field contains empty value then the file won't be uploaded because it checks for the below condition :

false === $uploads['error']

Attachments (2)

38119.diff (669 bytes) - added by PranaliPatel 14 months ago.
Here is the patch.
38119.2.diff (621 bytes) - added by PranaliPatel 14 months ago.
Ignore the previous one.

Download all attachments as: .zip

Change History (4)

@PranaliPatel
14 months ago

Here is the patch.

#1 @PranaliPatel
14 months ago

  • Keywords has-patch added

@PranaliPatel
14 months ago

Ignore the previous one.

#2 @azaozz
3 months ago

  • Keywords close added

Hi @PranaliPatel, thanks for the patch. As far as I see $uploads['error'] is checking the type. The default is false and anything else, including '', null, etc. would mean something may be wrong. As this is used by low level plugins that tweak the upload location(s), not sure we can change it without risk of breaking something. Also, is there a compelling user case to justify such change?

Note: See TracTickets for help on using tickets.