From: Kunal Mehta Date: Tue, 14 Aug 2018 05:49:53 +0000 (-0700) Subject: Parser: Call firstCallInit() in getTags/getFunctionHooks X-Git-Tag: 1.34.0-rc.0~4436^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/voir.php?a=commitdiff_plain;h=b7b8f214bb788c57ed1cc5ce70974f1a71df844c;p=lhc%2Fweb%2Fwiklou.git Parser: Call firstCallInit() in getTags/getFunctionHooks So callers don't need to do this manually. Pointed out by Tim in T201799. Depends-On: Ia6c36d5a650095e35093bf47e275e081e89b3daf Change-Id: Ida62767f3ca53f99609cae01d3a20051bb92ccab --- diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index c26bb625d2..eaa3bc12cc 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -784,7 +784,6 @@ class ApiQuerySiteinfo extends ApiQueryBase { public function appendExtensionTags( $property ) { global $wgParser; - $wgParser->firstCallInit(); $tags = array_map( function ( $item ) { return "<$item>"; @@ -799,7 +798,6 @@ class ApiQuerySiteinfo extends ApiQueryBase { public function appendFunctionHooks( $property ) { global $wgParser; - $wgParser->firstCallInit(); $hooks = $wgParser->getFunctionHooks(); ApiResult::setArrayType( $hooks, 'BCarray' ); ApiResult::setIndexedTagName( $hooks, 'h' ); diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index b1e39286b8..1fc2f9272b 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4926,6 +4926,7 @@ class Parser { * @return array */ public function getFunctionHooks() { + $this->firstCallInit(); return array_keys( $this->mFunctionHooks ); } @@ -5482,6 +5483,7 @@ class Parser { * @return array */ public function getTags() { + $this->firstCallInit(); return array_merge( array_keys( $this->mTransparentTagHooks ), array_keys( $this->mTagHooks ), diff --git a/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php b/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php index 7b93571013..fe2058fd18 100644 --- a/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php +++ b/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php @@ -571,7 +571,6 @@ class ApiQuerySiteinfoTest extends ApiTestCase { public function testExtensionTags() { global $wgParser; - $wgParser->firstCallInit(); $expected = array_map( function ( $tag ) { return "<$tag>"; @@ -585,7 +584,6 @@ class ApiQuerySiteinfoTest extends ApiTestCase { public function testFunctionHooks() { global $wgParser; - $wgParser->firstCallInit(); $this->assertSame( $wgParser->getFunctionHooks(), $this->doQuery( 'functionhooks' ) ); }