Page MenuHomePhabricator

Unprotected error on accessing `exists` field of `mw.title` object created with an invalid title
Closed, DuplicatePublic


The following Lua module provides a function that currently throws an error on line 6 (title.exists) when it is invoked: Lua error in mw.title.lua at line 209: bad argument #1 to 'pairs' (table expected, got nil).

local p = {}

	local title ="#")
	return title.exists

return p

This error happens because php.getExpensiveData( t.fullText ) on line 209 of mw.title.lua is nil.

# is an invalid title, and the documentation says that returns nil when supplied an invalid title, so I'd expect title to be nil and the error to be attempt to index a nil value.