Don't display size limit when there is no limit configured for file upload

Created on 25 August 2015, almost 10 years ago
Updated 12 July 2025, about 13 hours ago

Problem/Motivation

It is possible to configure PHP for no upload size limit, in which case the File widget says "Files must be less than 0 bytes", which is useless.

Old code was assumed there is always a limit, while the docs for file_upload_max_size explicity assume this case to be valid.

Attached patch only shows validator hint when a size limit is in effect.

Steps to reproduce

  1. Change the php ini settings as follows:
  2. [PHP]
      upload_max_filesize = 0;
      post_max_size = 0;
      
  3. Add a file field to a content type
  4. Add content of that type and look at the file field

Proposed resolution

Remaining tasks

Address feedback in #7
Write test
review
commit

User interface changes

Before

After

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component

file system

Created by

πŸ‡©πŸ‡ͺGermany mschuster91

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024