Last modified: 2011-08-05 14:53:15 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T32230, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30230 - action=expandtemplates should not silently override invalid title inputs
action=expandtemplates should not silently override invalid title inputs
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.20.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-04 18:31 UTC by db [inactive,noenotif]
Modified: 2011-08-05 14:53 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description db [inactive,noenotif] 2011-08-04 18:31:15 UTC
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.
Comment 1 Sam Reed (reedy) 2011-08-04 20:02:12 UTC
		if ( !$title_obj ) {
			$title_obj = Title::newFromText( 'API' ); // default
		}


It can quite obviously be seen in the code too ;)
Comment 2 db [inactive,noenotif] 2011-08-04 20:04:36 UTC
(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?
Comment 3 Sam Reed (reedy) 2011-08-04 20:05:59 UTC
r93905
Comment 4 Sam Reed (reedy) 2011-08-04 20:10:50 UTC
(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...
Comment 5 Mark A. Hershberger 2011-08-05 14:53:15 UTC
Resolved by r93905

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links