From 25f19be7094d8d0560b5958fa9b087c57c0879ab Mon Sep 17 00:00:00 2001 From: Alessandro Galli Date: Thu, 8 Sep 2016 10:47:29 +0200 Subject: [PATCH] solves profiler serialization problem with nested objects --- src/DataCollector/MongoDbDataCollector.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DataCollector/MongoDbDataCollector.php b/src/DataCollector/MongoDbDataCollector.php index 44848b2..cef5d53 100644 --- a/src/DataCollector/MongoDbDataCollector.php +++ b/src/DataCollector/MongoDbDataCollector.php @@ -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())); } @@ -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); } }