Remove PHP memory_limit from max upload size calculation #16741
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of Changes
With this PR I removed the current value for memory_limit from the max_upload_size calculation in JUtility::getMaxUploadSize. The memory_limit does NOT affect the maximum upload size of files as files are handled as streams which have a very low memory impact, therefore the value should not be taken into account.
Testing Instructions
We stumbled upon this issue while running the Joomla unit test suite in cli environment with memory_limit = -1 which means "unlimited memory".
Because of the way how the memory calculation in JUtility works, -1 is returned as the "smallest" and therefore limiting value, causing the unit test to fail.
So, in order to test this PR, you should run the JFormFieldFileTest (which uses JUtility in it's rendering) in a CLI environment with memory_limit = -1 - you'll get an error like this:
Afterwards, apply the patch and re-run the test, it will work now.
Expected result
The test suite should work.
Actual result
Error message, see above
Documentation Changes Required
none