Skip to content

Commit 834494e

Browse files
committed
review: check RoleHierarchy class on reflexion when extracting roles
1 parent 0b86dfa commit 834494e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Symfony/Component/Security/Core/Dumper/MermaidDumper.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

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

14+
use Symfony\Component\Security\Core\Role\RoleHierarchy;
1415
use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
1516

1617
/**
@@ -56,7 +57,11 @@ public function dump(RoleHierarchyInterface $roleHierarchy): string
5657

5758
private function extractHierarchy(RoleHierarchyInterface $roleHierarchy): array
5859
{
59-
$reflection = new \ReflectionClass($roleHierarchy);
60+
if (!$roleHierarchy instanceof RoleHierarchy) {
61+
return [];
62+
}
63+
64+
$reflection = new \ReflectionClass(RoleHierarchy::class);
6065

6166
if ($reflection->hasProperty('hierarchy')) {
6267
$hierarchyProperty = $reflection->getProperty('hierarchy');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy