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.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 22:35
Unknown Object (File)
Wed, Apr 17, 18:20
Unknown Object (File)
Wed, Apr 17, 06:51
Unknown Object (File)
Thu, Apr 4, 01:34
Unknown Object (File)
Mar 31 2024, 05:16
Unknown Object (File)
Mar 31 2024, 05:16
Unknown Object (File)
Mar 31 2024, 04:08
Unknown Object (File)
Mar 30 2024, 00:05

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
Lint
Lint Not Applicable
Unit
Tests Not Applicable