From 818756ede2eb7208f3cac32f34a93a68f99719de Mon Sep 17 00:00:00 2001 From: Rob Church Date: Fri, 17 Aug 2007 17:06:33 +0000 Subject: [PATCH] Make Xml::expandAttributes() a bit more robust against non-array arguments; people keep passing it things it doesn't like :( --- includes/Xml.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/includes/Xml.php b/includes/Xml.php index eaedb79e70..e0548edcfc 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -41,15 +41,12 @@ class Xml { * @param $attribs Array of attributes for an XML element */ private static function expandAttributes( $attribs ) { - if( is_null( $attribs ) ) { - return null; - } else { - $out = ''; - foreach( $attribs as $name => $val ) { - $out .= ' ' . $name . '="' . Sanitizer::encodeAttribute( $val ) . '"'; - } - return $out; + $out = ''; + if( is_array( $attribs ) ) { + foreach( $attribs as $name => $val ) + $out .= " {$name}=\"" . Sanitizer::encodeAttribute( $val ) . '"'; } + return $out; } /** -- 2.20.1