Steps to reproduce:
- PHP 8.1.8 without GD installed
- Create a project
- Go to http://phorge.localhost/project/manage/1/
- Select Edit Picture in the sidebar on the right to go to the Edit Project Picture at http://phorge.localhost/project/picture/1/
- On Custom: Choose Icon and Color..., Choose Background Color and Choose Icon, then click the Save Image button.
Actual outcome:
[2023-05-01 22:25:09] EXCEPTION: (Error) Call to undefined function imagecreatefromstring() at [<phorge>/src/applications/files/builtin/PhabricatorFilesComposeIconBuiltinFile.php:131] arcanist(head=T15263, ref.master=82d1abd4edd1, ref.T15263=4324d11c8b49), phorge(head=master, ref.master=8f669ea08289) #0 phlog(Error) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41] #1 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, Error) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751] #2 AphrontApplicationConfiguration::handleThrowable(Error) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296] #3 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204] #4 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]
Expected outcome:
Either a friendlier error message explaining what to do.
Or no error message at all.
Other comments:
Since PHP 8.0.0, PHP's imagecreatefromstring() "returns a GDImage instance on success; previously, a resource was returned."
Thus there is a currently undocumented requirement to have the PHP GD extension installed: https://www.php.net/manual/en/image.installation.php
I can confirm that installing php-gd-8.1.18 fixes the problem.