From ce2b3c8d45ff7fd842542d998b11ac9f043d7577 Mon Sep 17 00:00:00 2001 From: JuneHyeon Bae Date: Sat, 24 May 2014 19:48:02 +0900 Subject: [PATCH] Validates wgArticlePath does start with slash (/). When relative URL used in $wgArticlePath, and $wgArticlePath does not start with slash (/), raise FatalError. Bug: T48998 Change-Id: Ic7cd6f774cff97081f4f35af351161170b4b26eb --- includes/Setup.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/includes/Setup.php b/includes/Setup.php index 70e8cde420d4d..04a8459965deb 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -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 (/).

See ' . + '' . + 'https://www.mediawiki.org/wiki/Manual:$wgArticlePath' + ); +} + +Profiler::instance()->scopedProfileOut( $ps_validation ); + $ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' ); if ( $wgScriptExtension !== '.php' || defined( 'MW_ENTRY_PHP5' ) ) {