Make WordPress Core

Opened 4 years ago

Last modified 7 days 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 reporter-feedback
Focuses: Cc:



$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 4 years ago.
Here is the patch.
38119.2.diff (621 bytes) - added by PranaliPatel 4 years ago.
Ignore the previous one.

Download all attachments as: .zip

Change History (5)

4 years ago

Here is the patch.

#1 @PranaliPatel
4 years ago

  • Keywords has-patch added

4 years ago

Ignore the previous one.

#2 @azaozz
3 years 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?

#3 @hellofromTonya
7 days ago

  • Keywords reporter-feedback added

Hello @PranaliPatel,

Pinging you to continue discussions on this ticket. What do you think is a "compelling user case to justify such change?"

As Ozz notes, the false value is intentional, ie design decision. Anything other than this might indicate a problem or be a breaking change.

Note: See TracTickets for help on using tickets.