ZF-Commons / zfc-rbac

Role-based access control module to provide additional features on top of Zend\Permissions\Rbac
BSD 3-Clause "New" or "Revised" License
181 stars 111 forks source link

Cannot get a name and parameters for RoleProviderPluginManager #373 #374

Closed ashatrov closed 7 years ago

ashatrov commented 7 years ago

https://github.com/ZF-Commons/zfc-rbac/issues/373

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.01%) to 92.954% when pulling 312c0545876eb2a7d504a509c8204b3c90b10d5c on ashatrov:373_Cannot_get_a_name_and_parameters_for_RoleProviderPluginManager into 2ce24f11f608c6d14410ccf3792718eec41cf9c9 on ZF-Commons:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.01%) to 92.954% when pulling 312c0545876eb2a7d504a509c8204b3c90b10d5c on ashatrov:373_Cannot_get_a_name_and_parameters_for_RoleProviderPluginManager into 2ce24f11f608c6d14410ccf3792718eec41cf9c9 on ZF-Commons:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.01%) to 92.954% when pulling cf1c8eca0b4d0b32a1b98906def641537c6abfc0 on ashatrov:373_Cannot_get_a_name_and_parameters_for_RoleProviderPluginManager into 2ce24f11f608c6d14410ccf3792718eec41cf9c9 on ZF-Commons:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.01%) to 92.954% when pulling cf1c8eca0b4d0b32a1b98906def641537c6abfc0 on ashatrov:373_Cannot_get_a_name_and_parameters_for_RoleProviderPluginManager into 2ce24f11f608c6d14410ccf3792718eec41cf9c9 on ZF-Commons:master.

prolic commented 7 years ago

Please add a test case that fails without this addition.

ashatrov commented 7 years ago

@prolic I have no idea how to simulate it.

Anyway, it is the correct way to get firsts key of Array, because the internal pointer can point beyond the end of the elements list.

http://php.net/manual/en/function.key.php

Return Values

The key() function simply returns the key of the array element that's currently being pointed to by the internal pointer. It does not move the pointer in any way. If the internal pointer points beyond the end of the elements list or the array is empty, key() returns NULL.

If we need to have the first key, it must be with reset(), because we cannot know where is pointer now.

ashatrov commented 7 years ago

e.g.

<?php
$arr = ['foo' => 1];

echo key($arr); // foo

next($arr);
echo key($arr); // Null

reset($arr);
echo key($arr); // foo

Maybe there is while(next($config)) { // do something } somewhere in ZF.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.01%) to 92.954% when pulling 9204991da7041ca7b9b56c3645c30730d375455d on ashatrov:373_Cannot_get_a_name_and_parameters_for_RoleProviderPluginManager into 2ce24f11f608c6d14410ccf3792718eec41cf9c9 on ZF-Commons:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.01%) to 92.954% when pulling 9204991da7041ca7b9b56c3645c30730d375455d on ashatrov:373_Cannot_get_a_name_and_parameters_for_RoleProviderPluginManager into 2ce24f11f608c6d14410ccf3792718eec41cf9c9 on ZF-Commons:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.01%) to 92.954% when pulling 6dea80bf39fd0c34735f8e4a4ee9e906912f90be on ashatrov:373_Cannot_get_a_name_and_parameters_for_RoleProviderPluginManager into 2ce24f11f608c6d14410ccf3792718eec41cf9c9 on ZF-Commons:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.01%) to 92.954% when pulling 6dea80bf39fd0c34735f8e4a4ee9e906912f90be on ashatrov:373_Cannot_get_a_name_and_parameters_for_RoleProviderPluginManager into 2ce24f11f608c6d14410ccf3792718eec41cf9c9 on ZF-Commons:master.

humayunjamal commented 7 years ago

Hi Guys waiting for this pr to be merged

ghost commented 7 years ago

@prolic What is the policy for releases? Will you create a minor release 2.6.3 with this changes to be able to use it in composer from packagist?

prolic commented 7 years ago

@ashatrov-propertyfinder done with https://github.com/ZF-Commons/zfc-rbac/releases/tag/v2.6.3