@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Ignore bogus cards parameter string values in Hovercards calls

Summary:
Do not throw an exception when passing bogus parameter string values to hovercards. Instead, just convert to an empty array.
In consequence, see a proper hovercard correctly displaying `Unknown Object (????)` instead of an exception:
```
EXCEPTION: (TypeError) idx(): Argument #1 ($array) must be of type array, string given, called in /var/www/html/phorge/phorge/src/applications/search/controller/PhabricatorSearchHovercardController.php on line 37 at [<arcanist>/src/utils/utils.php:37]
```
See also similar rPa5384ca60470e56a5312d5a7147ddd3ffa2e75d8.

Closes T16075

Test Plan:
* Go to http://phorge.localhost/search/hovercard/?__path__=%2fsearch%2fhovercard%2f&cards={"layout":"foo"}
* Get an error message before applying the patch. Get an empty hovercard after applying the patch.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16075

Differential Revision: https://we.phorge.it/D26023

+6
+6
src/applications/search/controller/PhabricatorSearchHovercardController.php
··· 34 34 $handle_phids = array(); 35 35 $context_phids = array(); 36 36 foreach ($cards as $card) { 37 + if (!is_array($card)) { // ignore external fuzzing noise 38 + $card = array(); 39 + } 37 40 $object_phid = idx($card, 'objectPHID'); 38 41 39 42 $handle_phids[] = $object_phid; ··· 98 101 99 102 $results = array(); 100 103 foreach ($cards as $card_key => $card) { 104 + if (!is_array($card)) { // ignore external fuzzing noise 105 + $card = array(); 106 + } 101 107 $object_phid = idx($card, 'objectPHID'); 102 108 103 109 $handle = $handles[$object_phid];