Page MenuHomePhabricator

"Call to phutil_nonempty_string() expected null or a string, got: bool" rendering alt text of image file
Open, Stalled, LowPublicBUG REPORT

Description

Upstreamed as https://we.phorge.it/T16455

From our error logs:

[2023-11-27 22:32:12] EXCEPTION: (InvalidArgumentException) Call to phutil_nonempty_string() expected null or a string, got: bool. at [<arcanist>/src/utils/utils.php:2124]
arcanist(), ava(), phorge(), translations(), wmf-ext-misc()
  #0 <#2> phutil_nonempty_string(boolean) called at [<phorge>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:200]
  #1 <#2> PhabricatorEmbedFileRemarkupRule::renderImageFile(PhabricatorFile, PhabricatorObjectHandle, array) called at [<phorge>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:97]
  #2 <#2> PhabricatorEmbedFileRemarkupRule::renderObjectEmbed(PhabricatorFile, PhabricatorObjectHandle, array) called at [<phorge>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:135]
  #3 <#2> PhabricatorObjectRemarkupRule::renderObjectEmbedForAnyMedia(PhabricatorFile, PhabricatorObjectHandle, string) called at [<phorge>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:423]
  #4 <#2> PhabricatorObjectRemarkupRule::didMarkupText() called at [<phorge>/src/infrastructure/markup/remarkup/PhutilRemarkupEngine.php:362]
  #5 <#2> PhutilRemarkupEngine::postprocessText(array) called at [<phorge>/src/infrastructure/markup/remarkup/PhutilRemarkupEngine.php:106]
  #6 <#2> PhutilRemarkupEngine::markupText(string) called at [<phorge>/src/infrastructure/markup/PhabricatorMarkupEngine.php:620]
  #7 <#2> PhabricatorMarkupEngine::extractPHIDsFromMentions(PhabricatorUser, array) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:2060]
  #8 <#2> PhabricatorApplicationTransactionEditor::buildSubscribeTransaction(ManiphestTask, array, array) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:2224]
  #9 <#2> PhabricatorApplicationTransactionEditor::expandSupportTransactions(ManiphestTask, array) called at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1222]
  #10 <#2> PhabricatorApplicationTransactionEditor::applyTransactions(ManiphestTask, array) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:2031]
  #11 <#2> PhabricatorEditEngine::buildCommentResponse(ManiphestTask) called at [<phorge>/src/applications/transactions/editengine/PhabricatorEditEngine.php:998]
  #12 <#2> PhabricatorEditEngine::buildResponse() called at [<phorge>/src/applications/maniphest/controller/ManiphestTaskEditController.php:12]
  #13 <#2> ManiphestTaskEditController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #14 phlog(InvalidArgumentException) called at [<phorge>/src/aphront/handler/PhabricatorAjaxRequestExceptionHandler.php:27]
  #15 PhabricatorAjaxRequestExceptionHandler::handleRequestThrowable(AphrontRequest, InvalidArgumentException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #16 AphrontApplicationConfiguration::handleThrowable(InvalidArgumentException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #17 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #18 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

but wondering why this code does isset($options['alt']) instead of $file->getCustomAltText() anyway

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Add temporary debug output for T352170repos/phabricator/phabricator!32aklapperT352170debugwmf/stable
Customize query in GitLab

Event Timeline

Aklapper triaged this task as Low priority.
Aklapper changed the subtype of this task from "Task" to "Bug Report".

Never seen again. Please reopen if this still happens.

Happened again on 2025-03-06 for PHID-FILE-6sky7buyii3gsmlasjck which is F58617593, according to Apache logs when /file/dropupload/ing that image file while writing T379682#10608716. And I cannot reproduce this locally with those given steps.

Aklapper changed the task status from Stalled to Open.EditedJan 13 2026, 12:58 PM

Small progress:

We potentially have a pattern here - maybe somewhere in the code, the integer 1 gets interpreted as a true bool due to a wrong comparison?

Or rather, the line $option_string = trim($option_string, ', '); looks suspiciously involved here.

This pattern though did not apply for the previous case of F58617593 which shows "correct" dimensions in both fields. So I might be wrong.

I am wrong, the broken display of image dimensions in the alt text is a separate bug and does not necessarily lead to this exception, see e.g. F71517911

Aklapper moved this task from Backlog to Upstreamed on the Phabricator (Upstream) board.
Aklapper moved this task from Backlog to Reported Upstream on the Upstream board.
Aklapper changed the task status from Open to Stalled.Jan 15 2026, 3:57 PM
Aklapper moved this task from Reported Upstream to Patch proposed upstream on the Upstream board.