From: Marius Hoch Date: Tue, 18 Dec 2012 18:02:08 +0000 (+0100) Subject: Fix ApiQueryLogEvents::addLogParams for unknown types using the new format X-Git-Tag: 1.31.0-rc.0~21249 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=6571047c31dc46f57c3fb82ad2ef4b5ec9d8e105;p=lhc%2Fweb%2Fwiklou.git 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 --- 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; }