From 2f8772135b113414175fd9c63c697474ef64542b Mon Sep 17 00:00:00 2001 From: tonythomas01 <01tonythomas@gmail.com> Date: Sun, 12 Jan 2014 12:40:23 +0530 Subject: [PATCH] Check for CoreParserFunction::urlFunction from array to boolean and return values accordingly to htmlspecialchars() PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given in CoreParserFunctions.php on line 212 Checked for the return value of urlFunction in localurle() and fullurle() function Bug: 59881 Change-Id: I7ae092f89b9cfbbe91d1883c2182ca5907825ba4 --- includes/parser/CoreParserFunctions.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 3966b9e0e8..67b1c66205 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -209,7 +209,12 @@ class CoreParserFunctions { } static function localurle( $parser, $s = '', $arg = null ) { - return htmlspecialchars( self::urlFunction( 'getLocalURL', $s, $arg ) ); + $temp = self::urlFunction( 'getLocalURL', $s, $arg ); + if( !is_string( $temp ) ) { + return $temp; + } else { + return htmlspecialchars( $temp ); + } } static function fullurl( $parser, $s = '', $arg = null ) { @@ -217,7 +222,12 @@ class CoreParserFunctions { } static function fullurle( $parser, $s = '', $arg = null ) { - return htmlspecialchars( self::urlFunction( 'getFullURL', $s, $arg ) ); + $temp = self::urlFunction( 'getFullURL', $s, $arg ); + if( !is_string( $temp ) ) { + return $temp; + } else { + return htmlspecialchars( $temp ); + } } static function canonicalurl( $parser, $s = '', $arg = null ) { -- 2.20.1