Page MenuHomePhorge

preg_match() null exception setting custom user profile image with empty files.viewable-mime-types
ClosedPublic

Authored by aklapper on Jan 14 2024, 11:18.

Details

Summary

When files.viewable-mime-types is not set, getViewableMimeType() passes null to preg_match() which is deprecated behavior since PHP 8.1.
Only call preg_match() when there are some MIME types to compare.

ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/files/storage/PhabricatorFile.php:974]

Closes T15710

Test Plan

Go to a user profile and try to upload a custom profile picture in BMP format.

Diff Detail

Repository
rP Phorge
Branch
bmpUserProfileImageException (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1022
Build 1022: arc lint + arc unit