CoreParserFunctions::anchorencode should return a string
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 27 Mar 2013 16:53:14 +0000 (12:53 -0400)
committerDemon <chadh@wikimedia.org>
Wed, 27 Mar 2013 17:08:24 +0000 (17:08 +0000)
CoreParserFunctions::anchorencode incorrectly returns false rather than
the empty string when passed an empty string.

A simple cast fixes it; this likely wasn't noticed before since PHP was
automatically doing the cast anyway when the return value was merged
into wikitext.

Bug: 46608
Change-Id: I97556dbc4dcc1f102f6fed499d43dada388cdc5d

includes/parser/CoreParserFunctions.php

index 6aef08e..36bfb48 100644 (file)
@@ -753,7 +753,7 @@ class CoreParserFunctions {
         */
        static function anchorencode( $parser, $text ) {
                $text = $parser->killMarkers( $text );
-               return substr( $parser->guessSectionNameFromWikiText( $text ), 1);
+               return (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 );
        }
 
        static function special( $parser, $text ) {