From 6571047c31dc46f57c3fb82ad2ef4b5ec9d8e105 Mon Sep 17 00:00:00 2001 From: Marius Hoch Date: Tue, 18 Dec 2012 19:02:08 +0100 Subject: [PATCH] Fix ApiQueryLogEvents::addLogParams for unknown types using the new format Fixed ApiQueryLogEvents::addLogParams for unknown (probably extension) log types which use the new log format (with keys like 4:foo:paramname). Until now such keys we're directly put into the XML output resulting in invalid XML (see bug 43221, which will be fixed by this). To prevent this we just remove everything except the plain parameter name and use that as key for the output. Change-Id: I1a3c7ac624eb575b879d068d47d3a13c9972b1a1 --- includes/api/ApiQueryLogEvents.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 1b651680f0..9ef2c2203b 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -267,9 +267,19 @@ class ApiQueryLogEvents extends ApiQueryBase { break; } if ( !is_null( $params ) ) { - $result->setIndexedTagName( $params, 'param' ); - $result->setIndexedTagName_recursive( $params, 'param' ); - $vals = array_merge( $vals, $params ); + $logParams = array(); + // Keys like "4::paramname" can't be used for output so we change them to "paramname" + foreach ( $params as $key => $value ) { + if ( strpos( $key, ':' ) === false ) { + $logParams[$key] = $value; + continue; + } + $logParam = explode( ':', $key, 3 ); + $logParams[$logParam[2]] = $value; + } + $result->setIndexedTagName( $logParams, 'param' ); + $result->setIndexedTagName_recursive( $logParams, 'param' ); + $vals = array_merge( $vals, $logParams ); } return $vals; } -- 2.20.1