mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
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
This commit is contained in:
parent
5de10185ce
commit
7702772b2b
1 changed files with 7 additions and 4 deletions
|
@ -971,10 +971,13 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
||||||
// warns you if you don't have complete support.
|
// warns you if you don't have complete support.
|
||||||
|
|
||||||
$matches = null;
|
$matches = null;
|
||||||
$ok = preg_match(
|
$ok = false;
|
||||||
'@^image/(gif|png|jpe?g)@',
|
if ($this->getViewableMimeType() !== null) {
|
||||||
$this->getViewableMimeType(),
|
$ok = preg_match(
|
||||||
$matches);
|
'@^image/(gif|png|jpe?g)@',
|
||||||
|
$this->getViewableMimeType(),
|
||||||
|
$matches);
|
||||||
|
}
|
||||||
if (!$ok) {
|
if (!$ok) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue