Page MenuHomePhabricator

action=expandtemplates should not silently override invalid title inputs
Closed, ResolvedPublic

Description

bug 28578 was for action=parse, but action=expandtemplates does the same.

When action=expandtemplates receives an invalid title input, it defaults to "API"

This can be seen at http://en.wikipedia.org/w/api.php?action=expandtemplates&title=[a&text={{PAGENAME}}.

This behavior is unexpected and wrong. The api should die on invalid titles, see r88468.

Thanks.


Version: 1.20.x
Severity: normal

Details

Reference
bz30230

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:53 PM
bzimport set Reference to bz30230.
bzimport added a subscriber: Unknown Object (MLST).
		if ( !$title_obj ) {
			$title_obj = Title::newFromText( 'API' ); // default
		}

It can quite obviously be seen in the code too ;)

(In reply to comment #1)

if ( !$title_obj ) {
    $title_obj = Title::newFromText( 'API' ); // default
}

It can quite obviously be seen in the code too ;)

Not all people looking first into the code ;-)

There is also:

'title' => array(

ApiBase::PARAM_DFLT => 'API',

),

Maybe make title and text required?

(In reply to comment #2)

(In reply to comment #1)

if ( !$title_obj ) {
    $title_obj = Title::newFromText( 'API' ); // default
}

It can quite obviously be seen in the code too ;)

Not all people looking first into the code ;-)

There is also:

'title' => array(

ApiBase::PARAM_DFLT => 'API',

),

Maybe make title and text required?

No need to make Title required, if it's not a variable in the template expansion it is daft.

However, making text needed makes sense, then we don't pointlessly go through the effort of trying to expand "", and hence, the api can die out earlier by making it required...