From: Rob Church Date: Fri, 17 Aug 2007 17:06:33 +0000 (+0000) Subject: Make Xml::expandAttributes() a bit more robust against non-array arguments; people... X-Git-Tag: 1.31.0-rc.0~51738 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=818756ede2eb7208f3cac32f34a93a68f99719de;p=lhc%2Fweb%2Fwiklou.git Make Xml::expandAttributes() a bit more robust against non-array arguments; people keep passing it things it doesn't like :( --- 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; } /**