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:
commit
67433813e1
|
@ -41,7 +41,14 @@ class RequestDataCollector extends DataCollector
|
||||||
|
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
foreach ($request->attributes->all() as $key => $value) {
|
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;
|
$content = null;
|
||||||
|
|
Reference in New Issue