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
F3835354: D25516.1746085861.diff
Wed, Apr 30, 07:51
F3835353: D25516.1746085860.diff
Wed, Apr 30, 07:51
F3835352: D25516.1746085859.diff
Wed, Apr 30, 07:50
F3801607: D25516.1745957683.diff
Mon, Apr 28, 20:14
F3749031: D25516.1745790504.diff
Sat, Apr 26, 21:48
F3749030: D25516.1745790503.diff
Sat, Apr 26, 21:48
F3749029: D25516.1745790502.diff
Sat, Apr 26, 21:48
F3733984: D25516.1745754335.diff
Sat, Apr 26, 11:45

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