Upstreaming this from our server logs (Phorge at 52be52d429ce). Last changed in D25040 imported from Phabricator upstream.
Looks like we need to more lenient and allow scalars instead of strings only.
[2023-09-15 16:22:39] EXCEPTION: (InvalidArgumentException) Call to phutil_nonempty_string() expected null or a string, got: int. at [<arcanist>/src/utils/utils.php:2124] arcanist(), ava(), phorge(), translations(), wmf-ext-misc() #0 <#2> phutil_nonempty_string(integer) called at [<phorge>/src/applications/repository/storage/PhabricatorRepository.php:749] #1 <#2> PhabricatorRepository::generateURI(array) called at [<phorge>/src/applications/diffusion/request/DiffusionRequest.php:459] #2 <#2> DiffusionRequest::generateURI(array) called at [<phorge>/src/applications/diffusion/controller/DiffusionCommitBranchesController.php:39] #3 <#2> DiffusionCommitBranchesController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284] #4 phlog(InvalidArgumentException) called at [<phorge>/src/aphront/handler/PhabricatorAjaxRequestExceptionHandler.php:27] #5 PhabricatorAjaxRequestExceptionHandler::handleRequestThrowable(AphrontRequest, InvalidArgumentException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751] #6 AphrontApplicationConfiguration::handleThrowable(InvalidArgumentException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296] #7 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204] #8 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]
Steps to Reproduce
Visit this specific commit that belongs to main but also also to a numeric branch:
Call to phutil_nonempty_string() expected null or a string, got: int.
Additionally, visit the commit and see that the "Branches" does not load (since it also belongs to a numeric branch):
❌ https://phabricator.wikimedia.org/rOSWB5a588bf0ee10546ddb9d0872d1be1bf48b3f3c07
What Should Happen Instead
The commit should be visible without crashes, just like this:
✅ https://phabricator.wikimedia.org/rOSWB3c146aa84f5c1fa771425a0d9930cd0cc8b28fe8
etc.
Downstream: https://phabricator.wikimedia.org/T347483