Closed Deltik closed 1 year ago
Code Climate has analyzed commit 5196c4f5 and detected 0 issues on this pull request.
The test coverage on the diff in this pull request is 0.0% (80% is the threshold).
This pull request will bring the total coverage in the repository to 34.5% (-0.2% change).
View more on Code Climate.
Thank you @Deltik !
Motivation and Context
There is a bug where the
pm
plugin would return fatally error in PHP 8.2 if the user doesn't have permission to add an attachment when sending a private message. This error is due to the fact that the code expects$_FILES['file_userfile']
to be an array, but this array will not be present if the user doesn't have permission to add an attachment.Fixes #5025
Description
This change adds a check before trying to iterate through
$_FILES['file_userfile']
, ensuring that it is an array before processing the attachment. If this is not an array, then no actions will be taken on$_FILES['file_userfile']
, which avoids theTypeError
.How Has This Been Tested?
The fix was manually tested in a local development environment with PHP 8.2 by sending PMs with and without the attachment permission.
Types of Changes
Checklist