Check for CoreParserFunction::urlFunction from array to boolean
authortonythomas01 <01tonythomas@gmail.com>
Sun, 12 Jan 2014 07:10:23 +0000 (12:40 +0530)
committertonythomas01 <01tonythomas@gmail.com>
Thu, 30 Jan 2014 18:13:38 +0000 (23:43 +0530)
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

index 3966b9e..67b1c66 100644 (file)
@@ -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 ) {