Skip to content

Commit

Permalink
[HttpKernel] added extra information when collecting data from an obj…
Browse files Browse the repository at this point in the history
…ect if that object implements a __toString().
  • Loading branch information
Hugo Hamon committed Jan 17, 2012
1 parent e056480 commit 0c18324
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -41,7 +41,14 @@ public function collect(Request $request, Response $response, \Exception $except

$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;
Expand Down

0 comments on commit 0c18324

Please sign in to comment.