Page MenuHomePhorge

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

Description

Steps to reproduce:

  1. Phorge at cc964550f945b08c64970c01a34b55314e8ef0aa with php-gd installed, PHP 8.2.14
  2. Have http://phorge.localhost/config/edit/files.viewable-mime-types/ set to no entries:
[acko@fedora]$ /var/www/html/phorge/phorge/bin/config get files.viewable-mime-types
{
  "config": [
    {
      "key": "files.viewable-mime-types",
      "source": "local",
      "value": null,
      "status": "unset",
      "errorInfo": null
    },
    {
      "key": "files.viewable-mime-types",
      "source": "database",
      "value": null,
      "status": "unset",
      "errorInfo": null
    }
  ]
}
  1. Visit ProfileManageEdit Profile Picture
  2. Upload a Picture in BMP format

Actual outcome:
The correct message This server only supports these image formats: jpg, png, gif. is displayed but also:

[2024-01-14 10:58:12] 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]
arcanist(head=master, ref.master=6c7caf3572f4), phorge(head=master, ref.master=cc964550f945)
  #0 preg_match(string, NULL, NULL) called at [<phorge>/src/applications/files/storage/PhabricatorFile.php:974]
  #1 PhabricatorFile::isTransformableImage() called at [<phorge>/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php:60]
  #2 PhabricatorPeopleProfilePictureController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #3 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #4 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.