Really validate that $wgArticlePath starts with a slash
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 11 Nov 2015 22:00:31 +0000 (23:00 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Wed, 11 Nov 2015 22:01:18 +0000 (23:01 +0100)
The regular expression wasn't entirely correct.
Follow-up to a4a3d0454069c25a24e2bfe732a665cc6a865878.

Bug: T48998
Change-Id: I08bdf2db20c1c3de55527fc812bcbb55fa23f7bc

includes/Setup.php

index d826b87..bd20ac3 100644 (file)
@@ -520,12 +520,12 @@ 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 ) ) {
+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 ' .
+               'If you use a relative URL for $wgArticlePath, it must start ' .
+               'with a slash (<code>/</code>).<br><br>See ' .
                '<a href="https://www.mediawiki.org/wiki/Manual:$wgArticlePath">' .
-               'https://www.mediawiki.org/wiki/Manual:$wgArticlePath</a>'
+               'https://www.mediawiki.org/wiki/Manual:$wgArticlePath</a>.'
        );
 }