Skip to content

Commit

Permalink
solves profiler serialization problem with nested objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Galli committed Sep 8, 2016
1 parent 5c0846a commit 25f19be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/DataCollector/MongoDbDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function collect(Request $request, Response $response, \Exception $except
$event = $this->logger->getLoggedEvent();

// with extension version under 1.2.0 some Mongo objects can't be automatically serialized
if (-1 === strcmp(phpversion('mongodb'), '1.2.0')) {
if (-1 === version_compare(phpversion('mongodb'), '1.2.0')) {
$event->setData($this->prepareUnserializableData($event->getData()));
$event->setFilters($this->prepareUnserializableData($event->getFilters()));
}
Expand Down Expand Up @@ -130,8 +130,8 @@ private function prepareUnserializableData($data)
continue;
}

if (is_array($item)) {
$data[$key] = $this->prepareUnserializableData($item);
if (is_array($item) || is_object($item)) {
$data[$key] = $this->prepareUnserializableData((array)$item);
}
}

Expand Down

0 comments on commit 25f19be

Please sign in to comment.