Page MenuHomePhabricator
Paste P274

API weirdness on beta
ActivePublic

Authored by Krenair on Feb 9 2015, 7:37 PM.
Compare this to http://en.wikipedia.beta.wmflabs.org/w/api.php?format=json&uselang=en&action=opensearch&search=Template:Abou&suggest=
(as of writing, that returns ["Template:Abou",[],[],[]])
krenair@deployment-bastion:~$ sudo mwscript eval.php --wiki=enwiki
> $fr = new FauxRequest( array( 'format' => 'json', 'uselang' => 'en', 'action' => 'opensearch', 'search' => 'Template:Abou', 'suggest' => '' ) );
> $api = new ApiMain( $fr );
> $api->execute();
> var_dump( $api->getResultData() );
array(4) {
[0]=>
string(13) "Template:Abou"
[1]=>
array(3) {
[0]=>
string(14) "Template:About"
[1]=>
string(24) "Template:About Wikipedia"
[2]=>
string(51) "Template:About continent and region topic templates"
}
[2]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
string(172) "The continent/region-topic templates allow quick creation of navigational template for groups of articles about a common topic in different countries of a continent/region."
}
[3]=>
array(3) {
[0]=>
string(56) "http://en.wikipedia.beta.wmflabs.org/wiki/Template:About"
[1]=>
string(66) "http://en.wikipedia.beta.wmflabs.org/wiki/Template:About_Wikipedia"
[2]=>
string(93) "http://en.wikipedia.beta.wmflabs.org/wiki/Template:About_continent_and_region_topic_templates"
}
}
>
krenair@deployment-bastion:~$ sudo mwscript eval.php --wiki=enwiki
> $fr = new FauxRequest( array( 'format' => 'json', 'uselang' => 'en', 'action' => 'opensearch', 'search' => 'Template:Abou', 'suggest' => '' ) );
> $api = new ApiMain( $fr );
> $c = new ReflectionClass( 'ApiMain' );
> $p = $c->getProperty( 'mInternalMode' );
> $p->setAccessible( true );
> $p->setValue( $api, false );
> $m = $c->getMethod( 'executeAction' );
> $m->setAccessible( true );
> $m->invoke( $api );
PHP Notice: ob_clean(): failed to delete buffer. No buffer to delete in /mnt/srv/mediawiki-staging/php-master/includes/api/ApiFormatBase.php on line 188
Notice: ob_clean(): failed to delete buffer. No buffer to delete in /mnt/srv/mediawiki-staging/php-master/includes/api/ApiFormatBase.php on line 188
["Template:Abou",["Template:About","Template:About Wikipedia","Template:About continent and region topic templates"],["","","The continent/region-topic templates allow quick creation of navigational template for groups of articles about a common topic in different countries of a continent/region."],["http://en.wikipedia.beta.wmflabs.org/wiki/Template:About","http://en.wikipedia.beta.wmflabs.org/wiki/Template:About_Wikipedia","http://en.wikipedia.beta.wmflabs.org/wiki/Template:About_continent_and_region_topic_templates"]]