Page MenuHomePhabricator

Introduce soft assertions in MediaWiki
Open, Needs TriagePublic

Description

Input type documentation of older MediaWiki methods often does not match reality, which can result in breakage (T200456: MapCacheLRU::has called with invalid key. Must be string or integer. is an example). Newer code often uses wikimedia/assert to ensure correct input, but in older code that would cause breakage just the same.

We could add a "soft" version of assertions which logs invalid input but does not throw, add such assertions to common MediaWiki core classes, and use them to bring the parameter type documentation in sync with reality.

Event Timeline

@daniel any thoughts? Is this generic enough that maybe it should be discussed as an IRC? Or is it still in just-do-it-land?