Page MenuHomePhorge

Exception: Value passed to "phutil_string_cast()" is an array in PhabricatorApplicationSearchEngine.php
Closed, InvalidPublic

Description

Upstreaming this from our server logs (Phorge at 52be52d429ce); I checked that we have no offset of line numbers in downstream - there is not.

I'm quite puzzled that $query_key can be an array here. Looks like some Conduit API calls might allow passing that?

This code area was recently changed. In https://secure.phabricator.com/D21862 this code was changed to if ($query_key === null || !strlen($query_key)) instead of Phorge's D25204 $is_empty_query_key = phutil_string_cast($query_key) === '' approach.

[2023-09-08 11:18:38] EXCEPTION: (Exception) Value passed to "phutil_string_cast()" is an array; arrays can not be sensibly cast to strings. at [<arcanist>/src/utils/utils.php:1807]
arcanist(), ava(), phorge(), translations(), wmf-ext-misc()
  #0 <#2> phutil_string_cast(array) called at [<phorge>/src/applications/search/engine/PhabricatorApplicationSearchEngine.php:1140]
  #1 <#2> PhabricatorApplicationSearchEngine::buildConduitResponse(ConduitAPIRequest, ManiphestSearchConduitAPIMethod) called at [<phorge>/src/applications/search/engine/PhabricatorSearchEngineAPIMethod.php:52]
  #2 <#2> PhabricatorSearchEngineAPIMethod::execute(ConduitAPIRequest) called at [<phorge>/src/applications/conduit/method/ConduitAPIMethod.php:156]
  #3 <#2> ConduitAPIMethod::executeMethod(ConduitAPIRequest) called at [<phorge>/src/applications/conduit/call/ConduitCall.php:131]
  #4 <#2> ConduitCall::executeMethod() called at [<phorge>/src/applications/conduit/call/ConduitCall.php:81]
  #5 <#2> ConduitCall::execute() called at [<phorge>/src/applications/conduit/controller/PhabricatorConduitAPIController.php:83]
  #6 phlog(Exception) called at [<phorge>/src/applications/conduit/controller/PhabricatorConduitAPIController.php:111]
  #7 PhabricatorConduitAPIController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #8 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #9 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

Event Timeline

Without a reproduction, this is speculative.

Note that the upstream solution from Phabricator does not fix your problem, since

strlen(array())

Warning: strlen() expects parameter 1 to be string, array given in /home/user/scripts/code.php on line 2

This is causing a warning at least since PHP 4

It could also be some bots sending you fuzzy input. Consider to mark as invalid, until a real human being elevates this as a problem affecting some workflows.

Decreasing just a bit the priority since we are a bit confused about how to proceed but feel free to change

Makes sense; let's close for now. (I need to get used to Conduit throwing exceptions into our server log for random broken input. I do not like that Conduit behavior.)