Page MenuHomePhabricator

Hovercards: (RuntimeException) Undefined index: objectPHID (due to RequestURI all lowercase)
Open, LowPublicBUG REPORT

Description

Upstream: https://we.phorge.it/T15969

Sharing some logspam here. Not a common one but seen this a few times in the last weeks:

[2023-09-20 01:52:48] EXCEPTION: (RuntimeException) Undefined index: objectPHID at [<arcanist>/src/error/PhutilErrorHandler.php:251]
 arcanist(), ava(), phorge(), translations(), wmf-ext-misc()
   #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<phorge>/src/applications/search/controller/PhabricatorSearchHovercardController.php:101]
   #1 <#2> PhabricatorSearchHovercardController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
   #2 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
   #3 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
   #4 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
   #5 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
   #6 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]'

Related Objects

Event Timeline

Aklapper created this task.
Aklapper changed the subtype of this task from "Task" to "Bug Report".Oct 27 2023, 10:31 AM

One case in our logs so far:

[2023-11-03 01:21:15]
'RequestURI: /search/hovercard/?cards=%7B%22phid-user-tliyqayknga4r5aqqod6%2F%22%3A%7B%22objectphid%22%3A%22phid-user-tliyqayknga4r5aqqod6%22%2C%22contextphid%22%3Anull%7D%7D'
'Path: /search/hovercard/'
'User: '
'Viewer: '
'$names is empty'
EXCEPTION: (RuntimeException) Undefined index: objectPHID at [<arcanist>/src/error/PhutilErrorHandler.php:251]

The RequestURI looks all fine except its value is all lower case, and that is not how it should be:
?cards={"phid-user-tliyqayknga4r5aqqod6/":{"objectphid":"phid-user-tliyqayknga4r5aqqod6","contextphid":null}}

For the records, PHID-USER-tliyqayknga4r5aqqod6 is https://phabricator.wikimedia.org/p/Maintenance_bot/

Another appearance in the error logs on 2024-05-20 but only one URI call by the corresponding IP in the Apache access log.

But directly calling that URL itself also triggers the issue, heh.

Debugging this goes very low-level so I quickly put https://phabricator.wikimedia.org/P62943 together but not sure it's worth, given the low number of occurrences.

Aklapper renamed this task from Hovercards: (RuntimeException) Undefined index: objectPHID to Hovercards: (RuntimeException) Undefined index: objectPHID (due to RequestURI all lowercase).Jun 27 2024, 6:42 PM
Aklapper updated the task description. (Show Details)
Aklapper moved this task from Backlog to Upstreamed on the Phabricator (Upstream) board.

I more and more come to the conclusion that these are not real errors but broken webcrawlers screwing up random URIs, such as https://we.phorge.it/?__path__=%2fsearch%2fhovercard%2f&cards={%22whatever%22:{%22whatever%22:%22foobar%22}}. I upstreamed this issue.