Page MenuHomePhabricator

CirrusSearchSearcher::prefixSearch() returns a Status and breaks the PrefixSearchBackend hook caller
Closed, ResolvedPublic

Description

CirrusSearchSearcher::prefixSearch() with CirrusSearchTitleResultsType can return either a SearchResultSet subclass or a Status object. CirrusSearch::prefixSearch() puts this Status object directly into the &$results variable of the PrefixSearchBackend hook, without any validation, which is presumably the cause of the PHP warnings noted by Sam Reed at Id773c23747c.

The recommended pattern for using Status objects is to return a Status unconditionally, with Status::newGood($value) used to indicate success. This forces the caller to implement error handling, and thus avoids PHP errors of this kind.


Version: unspecified
Severity: major

Details

Reference
bz57961

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:15 AM
bzimport added a project: CirrusSearch.
bzimport set Reference to bz57961.
tstarling created this task.Dec 4 2013, 5:23 AM

Yeah, the bulk of Cirrus was written before you made that recommendation clear to me months ago and I haven't gotten around to retrofitting it is used in a few places but not others. Now is as good a time as any to make it universal.

Assigning high and working on it now because I'm not in the middle of anything and I'm not a fan of losing my intentional logs to unintentional mistakes.

Change 99144 had a related patch set uploaded by Manybubbles:
Switch search methods to always return status

https://gerrit.wikimedia.org/r/99144

Change 99144 merged by jenkins-bot:
Switch search methods to always return status

https://gerrit.wikimedia.org/r/99144