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
F3215705: D25516.1741660457.diff
Mon, Mar 10, 02:34
F3075488: D25516.1741054099.diff
Mon, Mar 3, 02:08
F3014898: D25516.1740698289.diff
Wed, Feb 26, 23:18
F3001429: D25516.1740442118.diff
Mon, Feb 24, 00:08
F3001428: D25516.1740442118.diff
Mon, Feb 24, 00:08
F2987193: D25516.1740110746.diff
Thu, Feb 20, 04:05
F2982287: D25516.1739948802.diff
Tue, Feb 18, 07:06
F2938345: D25516.1737994266.diff
Jan 26 2025, 16:11

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