Page MenuHomePhabricator

Revision::getPrevious() returns null within onNewRevisionFromEditComplete hook
Open, Needs TriagePublic


This ticket is to document the anomaly that caused T223828

Sometime in early May 2019, Revision::getPrevious() started returning null within the onNewRevisionFromEditComplete, even if a previous revision exists. This broke functionality in PageCuration. I have not confirmed this behaviour elsewhere in MediaWiki, but we were able to deduce nothing in PageTriage was the culprit.

Outside this context, Revision::getPrevious() works as expected. It seems to only be within onNewRevisionFromEditComplete. Changing the Core code to use READ_LATEST still does not resolve this issue, so I don't believe it is any sort of race condition.

A search shows the onNewRevisionFromEditComplete hook is not used many places and, for deployed WMF extensions, none are also using Revision::getPrevious(). Instead some (e.g. Wikibase) are using Revision::newFromId( $parentId ) to get the previous revision. Using this tactic worked for PageTriage, so we went with that.

The suspect patch I found was but even reverting it did not resolve the problem for me. I reverted back MediaWiki, and PageTriage, as far as I could (until I hit db changes), and I was still getting null for Revision::getPrevious(). So, the issue is truly a mystery!

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 18 2019, 12:30 AM

@daniel Adding you as a subscriber, should you want to pursue this further. I did not tag this with CPT Initiatives (MCR) as I can't confirm it's truly MCR-related, but that is my best guess.

Regardless, thank you for the help you provided over at T223828#5236438 :)

MusikAnimal updated the task description. (Show Details)Jun 18 2019, 12:33 AM
MusikAnimal updated the task description. (Show Details)