From 0c1832450d838f6fe1863c9fe0ed54fb3326cf25 Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Thu, 12 Jan 2012 12:59:59 +0100 Subject: [PATCH] [HttpKernel] added extra information when collecting data from an object if that object implements a __toString(). --- .../HttpKernel/DataCollector/RequestDataCollector.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index e22da19b20..18a447afcc 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -41,7 +41,14 @@ class RequestDataCollector extends DataCollector $attributes = array(); foreach ($request->attributes->all() as $key => $value) { - $attributes[$key] = is_object($value) ? sprintf('Object(%s)', get_class($value)) : $value; + if (is_object($value)) { + $attributes[$key] = sprintf('Object(%s)', get_class($value)); + if (is_callable(array($value, '__toString')) { + $attributes[$key] .= sprintf(' = %s', (string) $value); + } + } else { + $attributes[$key] = $value; + } } $content = null;