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
F2190411: D25516.1715720215.diff
Mon, May 13, 20:56
F2189941: D25516.1715697507.diff
Mon, May 13, 14:38
Unknown Object (File)
Mon, May 13, 12:25
Unknown Object (File)
Wed, May 8, 11:28
Unknown Object (File)
Sat, May 4, 14:21
Unknown Object (File)
Sat, May 4, 13:23
Unknown Object (File)
Sat, May 4, 12:31
Unknown Object (File)
Thu, Apr 25, 22:35

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