$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;
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;
/**
* 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;
$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] ) ) {
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" );
*/
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();
!! end
+!! test
+T35715: s/strike element in ToC
+!! wikitext
+__TOC__
+== <s>test</s> test <strike>test</strike> ==
+!! html
+<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
+<ul>
+<li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
+</ul>
+</div>
+
+<h2><span class="mw-headline" id="test_test_test"><s>test</s> test <strike>test</strike></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: test test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+
+!! end
+
# Note that the html output does not have the <p></p>, but the
# html+tidy output *does*. This is because the empty <p></p> is
# removed by the sanitizer, but only when tidy is *not* enabled (!).