From: Brion Vibber Date: Mon, 20 Aug 2007 13:43:14 +0000 (+0000) Subject: Throw an exception for invalid data in expandAttributes() so we get a backtrace and... X-Git-Tag: 1.31.0-rc.0~51721 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=f5ee414cad667b6cc2159c5362f32c84bec77eea;p=lhc%2Fweb%2Fwiklou.git Throw an exception for invalid data in expandAttributes() so we get a backtrace and can beat the shit out of whoever did us wrong instead of just seeing a useless PHP warning message or worse yet silently going through without even knowing we probably lost the data we wanted somewhere else in our output --- diff --git a/includes/Xml.php b/includes/Xml.php index e0548edcfc..2082d68322 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -45,6 +45,8 @@ class Xml { if( is_array( $attribs ) ) { foreach( $attribs as $name => $val ) $out .= " {$name}=\"" . Sanitizer::encodeAttribute( $val ) . '"'; + } else { + throw new MWException( 'Expected attribute array, got something else in ' . __METHOD__ ); } return $out; }