Make WordPress Core

Opened 12 years ago

Last modified 7 years ago

#23895 reviewing defect (bug)

Max upload size 0 when post_max_size = 0

Reported by: moscar09's profile moscar09 Owned by: johnbillion's profile johnbillion
Milestone: Future Release Priority: normal
Severity: normal Version: 3.5.1
Component: Upload Keywords: has-patch has-unit-tests dev-feedback
Focuses: Cc:

Description (last modified by SergeyBiryukov)

As a convention, post_max_size can be set to 0 to disable any limitation on max post size.

Quote from php.ini:

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size

WordPress does not take this into account in wp-admin/includes/template.php

Attachments (5)

23895.patch (2.5 KB) - added by biskobe 9 years ago.
Properly determine the file size if one of the values, checked in the function is zero, meaning unlimited.
23895_tests.patch (1.6 KB) - added by biskobe 9 years ago.
Tests for modified wp_max_upload_size function in previous patch.
23895.2.patch (2.6 KB) - added by biskobe 9 years ago.
Updated documentation for the change.
23895.3.patch (2.6 KB) - added by biskobe 9 years ago.
Added proper check for the optional parameters values. It would've failed with zero inputs.
23895_tests.2.patch (1.9 KB) - added by biskobe 9 years ago.
Previous tests didn't catch the problem because the values that I tested with were too small

Download all attachments as: .zip

Change History (15)

#1 @SergeyBiryukov
12 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
11 years ago

#26918 was marked as a duplicate.

#3 @SergeyBiryukov
11 years ago

It's worth noting that memory_limit can also affect file uploading:
http://php.net/manual/en/ini.core.php#ini.post-max-size

Last edited 11 years ago by SergeyBiryukov (previous) (diff)

This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.


11 years ago

#5 @SergeyBiryukov
11 years ago

#24558 was marked as a duplicate.

#6 @chriscct7
9 years ago

  • Keywords needs-patch added

@biskobe
9 years ago

Properly determine the file size if one of the values, checked in the function is zero, meaning unlimited.

@biskobe
9 years ago

Tests for modified wp_max_upload_size function in previous patch.

@biskobe
9 years ago

Updated documentation for the change.

#7 @biskobe
9 years ago

  • Keywords has-patch has-unit-tests dev-feedback added; needs-patch removed

@biskobe
9 years ago

Added proper check for the optional parameters values. It would've failed with zero inputs.

@biskobe
9 years ago

Previous tests didn't catch the problem because the values that I tested with were too small

#8 @johnbillion
9 years ago

  • Owner set to johnbillion
  • Status changed from new to reviewing

#9 @johnbillion
9 years ago

  • Milestone changed from Awaiting Review to Future Release

This ticket was mentioned in Slack in #core by jdorner. View the logs.


7 years ago

Note: See TracTickets for help on using tickets.