From: jenkins-bot Date: Wed, 28 Sep 2016 21:58:48 +0000 (+0000) Subject: Merge "rdbms: Lazy-init DatabaseDomain::getId()" X-Git-Tag: 1.31.0-rc.0~5284 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=88ada628defa0bda030b52342e433b5d52289562;hp=782254cf1f92794bbdaa91f473db07d8120c3d67;p=lhc%2Fweb%2Fwiklou.git Merge "rdbms: Lazy-init DatabaseDomain::getId()" --- diff --git a/includes/libs/filebackend/FileBackend.php b/includes/libs/filebackend/FileBackend.php index 0ef9f63a60..f33f52265b 100644 --- a/includes/libs/filebackend/FileBackend.php +++ b/includes/libs/filebackend/FileBackend.php @@ -185,15 +185,15 @@ abstract class FileBackend implements LoggerAwareInterface { $this->concurrency = isset( $config['concurrency'] ) ? (int)$config['concurrency'] : 50; - $this->obResetFunc = isset( $params['obResetFunc'] ) - ? $params['obResetFunc'] + $this->obResetFunc = isset( $config['obResetFunc'] ) + ? $config['obResetFunc'] : [ $this, 'resetOutputBuffer' ]; - $this->streamMimeFunc = isset( $params['streamMimeFunc'] ) - ? $params['streamMimeFunc'] + $this->streamMimeFunc = isset( $config['streamMimeFunc'] ) + ? $config['streamMimeFunc'] : null; $this->statusWrapper = isset( $config['statusWrapper'] ) ? $config['statusWrapper'] : null; - $this->profiler = isset( $params['profiler'] ) ? $params['profiler'] : null; + $this->profiler = isset( $config['profiler'] ) ? $config['profiler'] : null; $this->logger = isset( $config['logger'] ) ? $config['logger'] : new \Psr\Log\NullLogger(); $this->statusWrapper = isset( $config['statusWrapper'] ) ? $config['statusWrapper'] : null; $this->tmpDirectory = isset( $config['tmpDirectory'] ) ? $config['tmpDirectory'] : null; @@ -1620,7 +1620,7 @@ abstract class FileBackend implements LoggerAwareInterface { protected function scopedProfileSection( $section ) { if ( $this->profiler ) { call_user_func( [ $this->profiler, 'profileIn' ], $section ); - return new ScopedCallback( [ $this->profiler, 'profileOut' ] ); + return new ScopedCallback( [ $this->profiler, 'profileOut' ], [ $section ] ); } return null; diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 590d51e609..a32acc2d36 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4138,12 +4138,13 @@ class Parser { # * (r105284) # * (bug 72884) # * and (bug 35167) + # * and (T35715) # We strip any parameter from accepted tags (second regex), except dir="rtl|ltr" from , # to allow setting directionality in toc items. $tocline = preg_replace( [ - '#<(?!/?(span|sup|sub|bdi|i|b)(?: [^>]*)?>).*?>#', - '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|bdi|i|b))(?: .*?)?>#' + '#<(?!/?(span|sup|sub|bdi|i|b|s|strike)(?: [^>]*)?>).*?>#', + '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|bdi|i|b|s|strike))(?: .*?)?>#' ], [ '', '<$1>' ], $safeHeadline diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php index 4a2f759d5e..b17200f1cc 100644 --- a/includes/resourceloader/ResourceLoaderContext.php +++ b/includes/resourceloader/ResourceLoaderContext.php @@ -26,7 +26,7 @@ use MediaWiki\Logger\LoggerFactory; /** * Object passed around to modules which contains information about the state - * of a specific loader request + * of a specific loader request. */ class ResourceLoaderContext { protected $resourceLoader; @@ -62,26 +62,33 @@ class ResourceLoaderContext { $this->request = $request; $this->logger = $resourceLoader->getLogger(); + // Future developers: Avoid use of getVal() in this class, which performs + // expensive UTF normalisation by default. Use getRawVal() instead. + // Values here are either one of a finite number of internal IDs, + // or previously-stored user input (e.g. titles, user names) that were passed + // to this endpoint by ResourceLoader itself from the canonical value. + // Values do not come directly from user input and need not match. + // List of modules - $modules = $request->getVal( 'modules' ); + $modules = $request->getRawVal( 'modules' ); $this->modules = $modules ? self::expandModuleNames( $modules ) : []; // Various parameters - $this->user = $request->getVal( 'user' ); + $this->user = $request->getRawVal( 'user' ); $this->debug = $request->getFuzzyBool( 'debug', $resourceLoader->getConfig()->get( 'ResourceLoaderDebug' ) ); - $this->only = $request->getVal( 'only', null ); - $this->version = $request->getVal( 'version', null ); + $this->only = $request->getRawVal( 'only', null ); + $this->version = $request->getRawVal( 'version', null ); $this->raw = $request->getFuzzyBool( 'raw' ); // Image requests - $this->image = $request->getVal( 'image' ); - $this->variant = $request->getVal( 'variant' ); - $this->format = $request->getVal( 'format' ); + $this->image = $request->getRawVal( 'image' ); + $this->variant = $request->getRawVal( 'variant' ); + $this->format = $request->getRawVal( 'format' ); - $this->skin = $request->getVal( 'skin' ); + $this->skin = $request->getRawVal( 'skin' ); $skinnames = Skin::getSkinNames(); // If no skin is specified, or we don't recognize the skin, use the default skin if ( !$this->skin || !isset( $skinnames[$this->skin] ) ) { @@ -171,7 +178,7 @@ class ResourceLoaderContext { if ( $this->language === null ) { // Must be a valid language code after this point (T64849) // Only support uselang values that follow built-in conventions (T102058) - $lang = $this->getRequest()->getVal( 'lang', '' ); + $lang = $this->getRequest()->getRawVal( 'lang', '' ); // Stricter version of RequestContext::sanitizeLangCode() if ( !Language::isValidBuiltInCode( $lang ) ) { wfDebug( "Invalid user language code\n" ); @@ -187,7 +194,7 @@ class ResourceLoaderContext { */ public function getDirection() { if ( $this->direction === null ) { - $this->direction = $this->getRequest()->getVal( 'dir' ); + $this->direction = $this->getRequest()->getRawVal( 'dir' ); if ( !$this->direction ) { // Determine directionality based on user language (bug 6100) $this->direction = Language::factory( $this->getLanguage() )->getDir(); diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 1e511f67f5..c3975ca511 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -21651,6 +21651,22 @@ __TOC__ !! end +!! test +T35715: s/strike element in ToC +!! wikitext +__TOC__ +== test test test == +!! html +

Contents

+ +
+ +

test test test[edit]

+ +!! end + # Note that the html output does not have the

, but the # html+tidy output *does*. This is because the empty

is # removed by the sanitizer, but only when tidy is *not* enabled (!).