Skip to content

Commit

Permalink
Validates wgArticlePath does start with slash (/).
Browse files Browse the repository at this point in the history
When relative URL used in $wgArticlePath, and $wgArticlePath does not
start with slash (/), raise FatalError.

Bug: T48998
Change-Id: Ic7cd6f774cff97081f4f35af351161170b4b26eb
  • Loading branch information
devunt authored and Chad Horohoe committed Dec 18, 2015
1 parent 28e8709 commit ce2b3c8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions includes/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,21 @@

require_once "$IP/includes/compat/normal/UtfNormalUtil.php";


$ps_validation = Profiler::instance()->scopedProfileIn( $fname . '-validation' );

// T48998: Bail out early if $wgArticlePath is non-absolute
if ( !preg_match( '/^https?:\/\/|\//', $wgArticlePath ) ) {
throw new FatalError(
'If you use a relative URL on $wgArticlePath, it must start ' .
'with a slash (/).<br><br>See ' .
'<a href="https://www.mediawiki.org/wiki/Manual:$wgArticlePath">' .
'https://www.mediawiki.org/wiki/Manual:$wgArticlePath</a>'
);
}

Profiler::instance()->scopedProfileOut( $ps_validation );

$ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );

if ( $wgScriptExtension !== '.php' || defined( 'MW_ENTRY_PHP5' ) ) {
Expand Down

0 comments on commit ce2b3c8

Please sign in to comment.