merged branch hhamon/request_collector (PR #3131)

Commits
-------

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

Discussion
----------

[HttpKernel] added extra information when collecting data from an object...

... if that object implements a __toString().
This commit is contained in:
Fabien Potencier 2012-01-17 10:23:03 +01:00
commit 67433813e1
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;