mirror of
https://github.com/filp/whoops.git
synced 2026-09-14 11:46:19 +00:00
Only dump object internals if a custom caster exists
This commit is contained in:
@@ -8,6 +8,8 @@ namespace Whoops\Handler;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\VarDumper\Cloner\AbstractCloner;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use UnexpectedValueException;
|
||||
use Whoops\Exception\Formatter;
|
||||
use Whoops\Util\Misc;
|
||||
@@ -117,6 +119,23 @@ class PrettyPageHandler extends Handler
|
||||
// @todo: Make this more dynamic
|
||||
$helper = new TemplateHelper();
|
||||
|
||||
$cloner = new VarCloner();
|
||||
// Only dump object internals if a custom caster exists.
|
||||
$cloner->addCasters(['*' => function ($obj, $a, $stub, $isNested, $filter = 0) {
|
||||
$class = $stub->class;
|
||||
$classes = [$class => $class] + class_parents($class) + class_implements($class);
|
||||
|
||||
foreach ($classes as $class) {
|
||||
if (isset(AbstractCloner::$defaultCasters[$class])) {
|
||||
return $a;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all internals
|
||||
return [];
|
||||
}]);
|
||||
$helper->setCloner($cloner);
|
||||
|
||||
$templateFile = $this->getResource("views/layout.html.php");
|
||||
$cssFile = $this->getResource("css/whoops.base.css");
|
||||
$zeptoFile = $this->getResource("js/zepto.min.js");
|
||||
|
||||
Reference in New Issue
Block a user