Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 3758bb9

Browse files
committed
[HttpKernel] Use VarDumper in the profiler
1 parent 178ee8b commit 3758bb9

File tree

2 files changed

+8
-44
lines changed

2 files changed

+8
-44
lines changed

Core/Authorization/DebugAccessDecisionManager.php

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Security\Core\Authorization;
1313

14-
use Doctrine\Common\Util\ClassUtils;
1514
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1615

1716
/**
@@ -50,7 +49,7 @@ public function decide(TokenInterface $token, array $attributes, $object = null)
5049

5150
$this->decisionLog[] = array(
5251
'attributes' => $attributes,
53-
'object' => $this->getStringRepresentation($object),
52+
'object' => $object,
5453
'result' => $result,
5554
);
5655

@@ -96,39 +95,4 @@ public function getDecisionLog()
9695
{
9796
return $this->decisionLog;
9897
}
99-
100-
/**
101-
* @param mixed $object
102-
*
103-
* @return string
104-
*/
105-
private function getStringRepresentation($object)
106-
{
107-
if (null === $object) {
108-
return 'NULL';
109-
}
110-
111-
if (!is_object($object)) {
112-
if (is_bool($object)) {
113-
return sprintf('%s (%s)', gettype($object), $object ? 'true' : 'false');
114-
}
115-
if (is_scalar($object)) {
116-
return sprintf('%s (%s)', gettype($object), $object);
117-
}
118-
119-
return gettype($object);
120-
}
121-
122-
$objectClass = class_exists('Doctrine\Common\Util\ClassUtils') ? ClassUtils::getClass($object) : get_class($object);
123-
124-
if (method_exists($object, 'getId')) {
125-
$objectAsString = sprintf('ID: %s', $object->getId());
126-
} elseif (method_exists($object, '__toString')) {
127-
$objectAsString = (string) $object;
128-
} else {
129-
$objectAsString = sprintf('object hash: %s', spl_object_hash($object));
130-
}
131-
132-
return sprintf('%s (%s)', $objectClass, $objectAsString);
133-
}
13498
}

Core/Tests/Authorization/DebugAccessDecisionManagerTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ public function provideObjectsAndLogs()
3232
{
3333
$object = new \stdClass();
3434

35-
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'NULL', 'result' => false)), null);
36-
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'boolean (true)', 'result' => false)), true);
37-
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'string (jolie string)', 'result' => false)), 'jolie string');
38-
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'integer (12345)', 'result' => false)), 12345);
39-
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'resource', 'result' => false)), fopen(__FILE__, 'r'));
40-
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'array', 'result' => false)), array());
41-
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => sprintf('stdClass (object hash: %s)', spl_object_hash($object)), 'result' => false)), $object);
35+
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => null, 'result' => false)), null);
36+
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => true, 'result' => false)), true);
37+
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'jolie string', 'result' => false)), 'jolie string');
38+
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 12345, 'result' => false)), 12345);
39+
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => $x = fopen(__FILE__, 'r'), 'result' => false)), $x);
40+
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => $x = array(), 'result' => false)), $x);
41+
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => $object, 'result' => false)), $object);
4242
}
4343
}

0 commit comments

Comments
 (0)