From a4a3d0454069c25a24e2bfe732a665cc6a865878 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 ce091f176b..d826b8762f 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -516,6 +516,21 @@ MWExceptionHandler::installHandler(); 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 ( $wgCanonicalServer === false ) { -- 2.20.1