First of all: thanks for this great auth package.
I found an incorrect behaviour when using has_access with an array of roles to check for.
Code:
if (Warden::logged_in(array('y','x'))) [...]
will yield: ErrorException [ Notice ]: Trying to get property of non-object
This may have to do with array_udiff behaviour.
PHP version 5.3.3
With this simplified use you'll notice the behaviour:
$a1 = array(1,2);
$a2 = array(3,4);
$res = array_udiff($a1, $a2, function ($x, $y) {
// compare each given role against the user's roles
echo "compare $x with $y<br />";
return $x != $y;
});
print_r($res);
So, in the has_access method $ur will not always be an object, and thus $ur->name yields an error.
Additionally, the inline documentation states ' @param \Warden\Model_User $user The user to check against, if no user is given (null)
* it will check against the currently logged in user'.
First of all: thanks for this great auth package. I found an incorrect behaviour when using has_access with an array of roles to check for.
Code: if (Warden::logged_in(array('y','x'))) [...]
will yield: ErrorException [ Notice ]: Trying to get property of non-object
This may have to do with array_udiff behaviour. PHP version 5.3.3
With this simplified use you'll notice the behaviour:
$a1 = array(1,2); $a2 = array(3,4);
So, in the has_access method $ur will not always be an object, and thus $ur->name yields an error.
Additionally, the inline documentation states ' @param \Warden\Model_User $user The user to check against, if no user is given (null) * it will check against the currently logged in user'.
It doesn't.
Thanks again!