Skip to content

Commit

Permalink
[HttpKernel] updated HttpKernel::varToString()
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jun 20, 2011
1 parent 2e1747b commit 8b168a1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Symfony/Component/HttpKernel/HttpKernel.php
Expand Up @@ -181,7 +181,7 @@ private function handleException(\Exception $e, $request, $type)
private function varToString($var)
{
if (is_object($var)) {
return sprintf('[object](%s)', get_class($var));
return sprintf('Object(%s)', get_class($var));
}

if (is_array($var)) {
Expand All @@ -190,17 +190,25 @@ private function varToString($var)
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
}

return sprintf("[array](%s)", implode(', ', $a));
return sprintf("Array(%s)", implode(', ', $a));
}

if (is_resource($var)) {
return '[resource]';
return sprintf('Resource(%s)', get_resource_type($var));
}

if (null === $var) {
return 'null';
}

return str_replace("\n", '', var_export((string) $var, true));
if (false === $var) {
return 'false';
}

if (true === $var) {
return 'true';
}

return (string) $var;
}
}

0 comments on commit 8b168a1

Please sign in to comment.