Page MenuHomePhorge

Exception when "limit" (page size) API parameter is float
Closed, ResolvedPublic

Description

  1. PHP 8.3.6, Phorge at 81653abb5440109eb82c734d1671753a738dec3a
  2. Go to http://phorge.localhost/conduit/method/maniphest.search/
  3. In the limit field, enter a non-integer value less than 100, like e.g. 14.6
  4. Click Call Method button
  5. Check DarkConsole or your server-side error log

Actual outcome:
Since PHP 8.1 this triggers an exception:

[2024-05-03 15:40:53] ERROR 8192: Implicit conversion from float 14.6 to int loses precision at [/var/www/html/phorge/phorge/src/view/control/AphrontCursorPagerView.php:76]
arcanist(head=master, ref.master=ef73b12b580e), phorge(head=arcpatch-D25502, ref.master=81653abb5440, ref.arcpatch-D25502=7d0b7b977cde), translations(head=wmf/stable, ref.master=09fe573a932a, ref.wmf/stable=e45c643766c8)
  #0 array_slice(array, integer, double, boolean) called at [<phorge>/src/view/control/AphrontCursorPagerView.php:76]
  #1 AphrontCursorPagerView::sliceResults(array) called at [<phorge>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:403]
  #2 PhabricatorCursorPagedPolicyAwareQuery::executeWithCursorPager(AphrontCursorPagerView) called at [<phorge>/src/applications/search/engine/PhabricatorApplicationSearchEngine.php:1040]
  #3 PhabricatorApplicationSearchEngine::executeQuery(ManiphestTaskQuery, AphrontCursorPagerView) called at [<phorge>/src/applications/search/engine/PhabricatorApplicationSearchEngine.php:1232]
  #4 PhabricatorApplicationSearchEngine::buildConduitResponse(ConduitAPIRequest, ManiphestSearchConduitAPIMethod) called at [<phorge>/src/applications/search/engine/PhabricatorSearchEngineAPIMethod.php:52]
  #5 PhabricatorSearchEngineAPIMethod::execute(ConduitAPIRequest) called at [<phorge>/src/applications/conduit/method/ConduitAPIMethod.php:156]
  #6 ConduitAPIMethod::executeMethod(ConduitAPIRequest) called at [<phorge>/src/applications/conduit/call/ConduitCall.php:131]
  #7 ConduitCall::executeMethod() called at [<phorge>/src/applications/conduit/call/ConduitCall.php:81]
  #8 ConduitCall::execute() called at [<phorge>/src/applications/conduit/controller/PhabricatorConduitAPIController.php:83]
  #9 PhabricatorConduitAPIController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #10 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #11 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

Expected outcome:
As a server admin, I am less interested in invalid data entered by users, so I'd prefer to silence this output.

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.