Page MenuHomePhabricator

Fix footgun DB query in RevisionStore::getTimestampFromId
Closed, ResolvedPublic


It seems this method (unintentionally?) accepts a null value, leading to a strange and confusing query:

SELECT rev_timestamp FROM `revision` WHERE rev_id IS NULL LIMIT 1

This was uncovered in by patching high-level Skin code.

I think this should either be made impossible with a strict parameter type that disallows non-integer values, or it needs to be explicitly supported with a test and possibly an inline optimisation for the null case so that this logic does not reside in the Skin layer.

Event Timeline

Change 657554 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] RevisionStore: Prevent useless DB query

Change 657554 merged by jenkins-bot:
[mediawiki/core@master] RevisionStore: Prevent useless DB query

Ammarpad claimed this task.