Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Standard RoleHierarchyVoter always return 1 #16358

Closed
@sergio-ivanuzzo

Description

@sergio-ivanuzzo

I found this bug in the process of solving the problem http://stackoverflow.com/questions/33346543/symfony2-how-to-disable-default-voter

Code of method "createRoleHierarchy" in the Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

if (!isset($config['role_hierarchy'])) {
    $container->removeDefinition('security.access.role_hierarchy_voter');
    return;
 }

not work properly, because role_hierarchy contains empty array, when I remove role_hierarchy from my config. so, isset($config['role_hierarchy']) always returns true

And according to comments at #Symfony irc channel from user dantleec1:

yeah, the Configuration class adds the key as an array: https://github.com/symfony/symfony/blob/2.3/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php#L136
so I guess NULL resolves to an empty array

To reprocude this bug you need to add code like

var_dump(get_class($voter) . ":" . $result);

to decideConsensus or another decide method of AccessDecisionManager.

I'm use linux, have Symfony version 2.7.5, PHP 5.5.9

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions