From f5ee414cad667b6cc2159c5362f32c84bec77eea Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 20 Aug 2007 13:43:14 +0000 Subject: [PATCH] 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 --- includes/Xml.php | 2 ++ 1 file changed, 2 insertions(+) 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; } -- 2.20.1