HomePhorge

preg_match() null exception setting custom user profile image with empty files.

Description

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

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.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15710

Differential Revision: https://we.phorge.it/D25516

Details

Provenance
Andre KlapperAuthored on Jan 17 2024, 7:13 AM
themackabuPushed on Mar 25 2025, 8:07 PM
Parents
rP5de10185ce5b: Config User Extra Fields: link to the doc (like Maniphest)
Branches
Unknown
Tags
Unknown

Event Timeline