So firstly this issue is totally my fault, so feel free to reject immediately, but I had to debug the issue in order to determine what I'd done wrong and I though you might like the code
I was unable to Create new Projects due to a "page isn't working HTTP ERROR 500" error when I hit the "Create New Project" button
The cause of this problem was that I had recently upgraded to PHP7.1 (to overcome a max string issue), and hadn't noticed the "Setup" issue which now said I didn't have PHP GD extension installed
checking the log I found
[Sat May 20 03:12:12 2017] [notice] [client 172.24.145.103] [2017-05-20 08:12:12] EXCEPTION: (Error) Call to undefined function imagecreatefromstring() at [<phabricator>/src/applications/files/builtin/PhabricatorFilesComposeIconBuiltinFile.php:131] [Sat May 20 03:12:12 2017] [notice] [client 172.24.145.103] arcanist(head=master, ref.master=129d51fa0936), phabricator(head=master, ref.master=1644b4505057), phutil(head=master, ref.master=a900d7b63e95), sprint(head=master, ref.master=7a7368cd2162) [Sat May 20 03:12:12 2017] [notice] [client 172.24.145.103] #0 PhabricatorFilesComposeIconBuiltinFile::composeImage(array, array) called at [<phabricator>/src/applications/files/builtin/PhabricatorFilesComposeIconBuiltinFile.php:42] [Sat May 20 03:12:12 2017] [notice] [client 172.24.145.103] #1 PhabricatorFilesComposeIconBuiltinFile::loadBuiltinFileData() called at [<phabricator>/src/applications/project/editor/PhabricatorProjectTransactionEditor.php:670] [Sat May 20 03:12:12 2017] [notice] [client 172.24.145.103] #2 PhabricatorProjectTransactionEditor::setDefaultProfilePicture(PhabricatorProject) called at [<phabricator>/src/applications/project/editor/PhabricatorProjectTransactionEditor.php:498] [Sat May 20 03:12:12 2017] [notice] [client 172.24.145.103] #3 PhabricatorProjectTransactionEditor::applyFinalEffects(PhabricatorProject, array) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1010] [Sat May 20 03:12:12 2017] [notice] [client 172.24.145.103] #4 PhabricatorApplicationTransactionEditor::applyTransactions(PhabricatorProject, array) called at [<phabricator>/src/applications/transactions/editengine/PhabricatorEditEngine.php:1089] [Sat May 20 03:12:12 2017] [notice] [client 172.24.145.103] #5 PhabricatorEditEngine::buildEditResponse(PhabricatorProject) called at [<phabricator>/src/applications/transactions/editengine/PhabricatorEditEngine.php:947] [Sat May 20 03:12:12 2017] [notice] [client 172.24.145.103] #6 PhabricatorEditEngine::buildResponse() called at [<phabricator>/src/applications/project/controller/PhabricatorProjectEditController.php:91] [Sat May 20 03:12:12 2017] [notice] [client 172.24.145.103] #7 PhabricatorProjectEditController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:268] [Sat May 20 03:12:12 2017] [notice] [client 172.24.145.103] #8 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:177]
I searched on your github mirror for imagecreatefromstring() and notice that sometimes you guard against its existence.
in PhabricatorFileImageTransform.php I notice you perform a check and that check lead me to the root cause, only then did I notice you were showing me the root cause in the setup warnings (again my bad!)
There are a couple of other places where the use of this function isn't guarded, if it had been it would have helped me get to the solution quicker, if you'd like me to contribute a patch that fixes all those places too I'd be more than happy to do that.
so I felt it would be good if at least I shared what I did to resolve it. Below is the one guard I needed to get a more meaningful message in the UI that prompts me to fix my setup issues.
diff --git a/src/applications/files/builtin/PhabricatorFilesComposeIconBuiltinFile.php b/src/applications/files/builtin/PhabricatorFilesComposeIconBuiltinFile.php index 0bb56490c..1db7604fe 100644 --- a/src/applications/files/builtin/PhabricatorFilesComposeIconBuiltinFile.php +++ b/src/applications/files/builtin/PhabricatorFilesComposeIconBuiltinFile.php @@ -128,6 +128,13 @@ final class PhabricatorFilesComposeIconBuiltinFile $path = idx($icon, 'path'); $data = Filesystem::readFile($path); + if (!function_exists('imagecreatefromstring')) { + throw new Exception( + pht( + 'Unable to transform image: the imagecreatefromstring() function '. + 'is not available. Install or enable the "gd" extension for PHP.')); + } + $icon_img = imagecreatefromstring($data); $canvas = imagecreatetruecolor(200, 200);
Just wanted to say, that I totally love Phabricator, we use it (slightly modified) with CVS and it works a treat, Many thanks for your hard work.