Skip to content

Unable to upload files when PHP post_max_size is set to 0 #45905

@johnrix

Description

@johnrix

Steps to reproduce the issue

  1. Update php.ini file to set post_max_size to 0 (and restart PHP/Apache)
  2. Attempt to upload any extension from the Upload Package File tab on the Manage Extensions page

Expected result

Extension should be uploaded and deployed successfully.

Actual result

Upload fails instant with the following message:

"The selected file cannot be uploaded as it is bigger than the maximum upload size."

System information (as much as possible)

Ubuntu 22.04.4 LTS
Apache/2.4.52 (Ubuntu)
PHP 8.3.8 (using FPM)
Joomla 5.3.2

Additional comments

The problem appears to be within Joomla\Filesystem\Helper::getFileUploadMaxSize(), and specifically this clause:

$maxSize === 0

$maxSize is previously assign as follows, which results in a float value according to the return type of self::parseSize():

$maxSize = self::parseSize(\ini_get('post_max_size'));

Comparing $maxSize to an integer value (0) consequently fails. Hence, the return value of the function is 0, preventing any file being uploaded.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions