Work around exception in Herald transcript of old tasks: Call to a member function getAppliedTransactionPHIDs() on bool
Summary:
In some cases, older Herald transcripts which got garbage collected display an exception.
For unknown reasons, calling getObjectTranscript() on the HeraldTranscript object $xscript can return a bool with the value false.
Afterwards, calling getAppliedTransactionPHIDs() on that bool throws an exception.
Thus as a workaround, return an empty array instead in this case, like the code already does when $xscript->getObjectTranscript()->getAppliedTransactionPHIDs() === null.
Note that it remains unclear whether/when the bool may have the value true hence this situation is not covered by this code change (the code would still throw an exception in this situation).
Closes T15343
Test Plan:
- Change system time to one year back (or optionally, use ./phorge/bin/garbage set-policy --collector herald.transcripts --days 1, drop steps 9 and 10, and wait a day before performing step 11)
- As an admin, go to http://phorge.localhost/herald/create/
- Select "Maniphest Tasks"
- On http://phorge.localhost/herald/create/?adapter=HeraldManiphestTaskAdapter , select "Global Rule"
- Under "Conditions", select any of and set the three conditions Description | contains | Internet Archive, Description | contains | archive.org, Description | contains | Wayback Machine.
- Under "Action", select Add projects | someProject
- Select "Save Rule"
- Trigger the rule by creating a new task.
- Change system time back to today
- On the shell, run ./phorge/bin/phd restart
- Visit created task and select "View Herald Transcript"
- Transcript page displays "Old Transcript - Details of this transcript have been garbage collected." and shows no exception anymore
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15343
Differential Revision: https://we.phorge.it/D25246