From: Niklas Laxström Date: Thu, 8 Sep 2011 16:59:19 +0000 (+0000) Subject: Switch JSON to (un)serialize X-Git-Tag: 1.31.0-rc.0~27788 X-Git-Url: http://git.cyclocoop.org//%27http:/code.google.com/p/ie7-js//%27?a=commitdiff_plain;h=ec5a25079a4aa28331d14d1d3be3abf1258ba9f1;p=lhc%2Fweb%2Fwiklou.git Switch JSON to (un)serialize --- diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php index 9ba66bce3d..f279ee5349 100644 --- a/includes/logging/LogEntry.php +++ b/includes/logging/LogEntry.php @@ -203,13 +203,21 @@ class DatabaseLogEntry extends LogEntryBase { public function getParameters() { if ( !isset( $this->params ) ) { $blob = $this->getRawParameters(); - $params = FormatJson::decode( $blob, true /* array */ ); - if ( $params !== null ) { + wfSuppressWarnings(); + $params = unserialize( $blob ); + wfRestoreWarnings(); + if ( $params !== false ) { $this->params = $params; $this->legacy = false; } else { - $this->params = explode( "\n", $blob ); - $this->legacy = true; + $params = FormatJson::decode( $blob, true /* array */ ); + if ( $params !== null ) { + $this->params = $params; + $this->legacy = false; + } else { + $this->params = explode( "\n", $blob ); + $this->legacy = true; + } } } return $this->params; @@ -319,7 +327,7 @@ class ManualLogEntry extends LogEntryBase { } /** - * Set extra log parameters. + * Set extra log parameters. * You can pass params to the log action message * by prefixing the keys with a number and colon. * The numbering should start with number 4, the @@ -380,7 +388,7 @@ class ManualLogEntry extends LogEntryBase { 'log_title' => $this->getTarget()->getDBkey(), 'log_page' => $this->getTarget()->getArticleId(), 'log_comment' => $this->getComment(), - 'log_params' => FormatJson::encode( (array) $this->getParameters() ), + 'log_params' => serialize( (array) $this->getParameters() ), ); $dbw->insert( 'logging', $data, __METHOD__ ); $this->id = !is_null( $id ) ? $id : $dbw->insertId(); @@ -414,7 +422,7 @@ class ManualLogEntry extends LogEntryBase { $this->getSubtype(), $this->getTarget(), $this->getComment(), - FormatJson::encode( (array) $this->getParameters() ), + serialize( (array) $this->getParameters() ), $newId );