Page MenuHomePhorge

Exception awarding badge to user without selecting a badge
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. Phorge at ea554af476493bd27017017c230b8e8a76b8dd4d, PHP 8.3.6
  2. Go to a user's badges, e.g. http://phorge.localhost/people/badges/29/
  3. Click the Award Badge button
  4. Do not select any Badge, directly click the Award button

Expected outcome:

Ideally an in-dialog error message, but as that's more complicated in this conde structure, probably the same behavior as on http://phorge.localhost/badges/recipients/2/ when selecting Add Recipients and clicking Add Recipients without entering any username: Page simply reloads with no changes and no errors either.

Actual outcome:

[2024-05-12 08:07:59] EXCEPTION: (AphrontParameterQueryException) Array for %Ls conversion is empty. Query: badges.phid IN (%Ls) at [<phorge>/src/infrastructure/storage/xsprintf/qsprintf.php:383]
arcanist(head=master, ref.master=7f28d7266f81), phorge(head=master, ref.master=ea554af47649), translations(head=wmf/stable, ref.master=09fe573a932a, ref.wmf/stable=e45c643766c8)
  #0 <#2> qsprintf_check_type(array, string, string) called at [<phorge>/src/infrastructure/storage/xsprintf/qsprintf.php:155]
  #1 <#2> xsprintf_query(array, string, integer, array, integer) called at [<arcanist>/src/xsprintf/xsprintf.php:82]
  #2 <#2> xsprintf(string, array, array) called at [<phorge>/src/infrastructure/storage/xsprintf/PhutilQueryString.php:25]
  #3 <#2> PhutilQueryString::__construct(AphrontMySQLiDatabaseConnection, array) called at [<phorge>/src/infrastructure/storage/xsprintf/qsprintf.php:78]
  #4 <#2> qsprintf(AphrontMySQLiDatabaseConnection, string, array) called at [<phorge>/src/applications/badges/query/PhabricatorBadgesQuery.php:56]
  #5 <#2> PhabricatorBadgesQuery::buildWhereClauseParts(AphrontMySQLiDatabaseConnection) called at [<phorge>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:505]
  #6 <#2> PhabricatorCursorPagedPolicyAwareQuery::buildWhereClause(AphrontMySQLiDatabaseConnection) called at [<phorge>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:328]
  #7 <#2> PhabricatorCursorPagedPolicyAwareQuery::buildStandardPageQuery(AphrontMySQLiDatabaseConnection, string) called at [<phorge>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:302]
  #8 <#2> PhabricatorCursorPagedPolicyAwareQuery::loadStandardPageRowsWithConnection(AphrontMySQLiDatabaseConnection, string) called at [<phorge>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:293]
  #9 <#2> PhabricatorCursorPagedPolicyAwareQuery::loadStandardPageRows(PhabricatorBadgesBadge) called at [<phorge>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:287]
  #10 <#2> PhabricatorCursorPagedPolicyAwareQuery::loadStandardPage(PhabricatorBadgesBadge) called at [<phorge>/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php:283]
  #11 <#2> PhabricatorCursorPagedPolicyAwareQuery::loadPage() called at [<phorge>/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php:251]
  #12 <#2> PhabricatorPolicyAwareQuery::execute() called at [<phorge>/src/applications/badges/controller/PhabricatorBadgesAwardController.php:30]
  #13 <#2> PhabricatorBadgesAwardController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #14 phlog(AphrontParameterQueryException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #15 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, AphrontParameterQueryException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #16 AphrontApplicationConfiguration::handleThrowable(AphrontParameterQueryException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #17 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #18 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]