diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-09-10 05:56:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-10 05:56:05 +0300 |
commit | 3f64755160241793de0bb77b42276e6a43f27582 (patch) | |
tree | b693e6a6e361268a380166d746cd8a7c38602d1d | |
parent | a977e87ecf20b075c8e9c0daf53469d8b6d075db (diff) |
Remove COLUMN_AGGREGATION_OPS_METADATA_NAME metadata before serializing original format since it can have closures. (#13304)
-rw-r--r-- | plugins/API/Renderer/Original.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/API/Renderer/Original.php b/plugins/API/Renderer/Original.php index ca33e4e81b..815d475d71 100644 --- a/plugins/API/Renderer/Original.php +++ b/plugins/API/Renderer/Original.php @@ -10,6 +10,8 @@ namespace Piwik\Plugins\API\Renderer; use Piwik\API\ApiRenderer; use Piwik\Common; +use Piwik\DataTable; +use Piwik\DataTable\DataTableInterface; class Original extends ApiRenderer { @@ -83,6 +85,15 @@ class Original extends ApiRenderer private function serializeIfNeeded($response) { if ($this->shouldSerialize()) { + if ($response instanceof DataTableInterface) { + // remove COLUMN_AGGREGATION_OPS_METADATA_NAME metadata since it can have closures + $response->filter(function (DataTable $table) { + $allMetadata = $table->getAllTableMetadata(); + unset($allMetadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]); + $table->setAllTableMetadata($allMetadata); + }); + } + return serialize($response); } return $response; |