[HttpKernel] added extra information when collecting data from an object if that object implements a __toString().

This commit is contained in:
Hugo Hamon 2012-01-12 12:59:59 +01:00
parent e056480ab2
commit 0c1832450d
1 changed files with 8 additions and 1 deletions

View File

@ -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;