https://web.archive.org/web/20210530012858/https://discourse.phabricator-community.org/t/phabricator-project-search-api-broken-after-2020-16-release/3904/8 covered an issue when running an empty project.search Conduit query and having custom fields defined. (I do not understand the exact steps to reproduce though.)
The thread includes a three line defensive patch which seems to have never reached the Phorge (née Phabricator) codebase and received positive feedback from Evan.
Quoting cmfitch1:
I should’ve mentioned that I’m doing an empty project.search query to obtain a list of all projects in phabricator. I’m looking into loadStorageSourceData() and having a bit of trouble connecting the code to the comment. The comment indicates that it wants to return stored information pertaining to the requested fields. What I’m seeing is that it gets the list of fields, puts the information into $map, then pulls everything from the project_customfieldstorage db table and expects it to be in $map. My db table has fields in it that weren’t requested in $fields, causing the $map lookup to fail on the line in the stack trace. Checking to see if the entry in $row was a requested value in $map before accessing it provides results from the API query, but I don’t have enough system level knowledge to know if this is an acceptable fix.
src/infrastructure/customfield/storage/PhabricatorCustomFieldStorage.php @@ -80,6 +80,10 @@ abstract class PhabricatorCustomFieldStorage $object_phid = $row['objectPHID']; $value = $row['fieldValue']; + if (!isset($map[$index]) || !isset($map[$index][$object_phid])) { + continue; + } + $key = $map[$index][$object_phid]; $result[$key] = $value; }
Stumbled upon this in downstream https://phabricator.wikimedia.org/rPHAB9082e93c588d304d990b7f617c68e179d7f2dde2