[dev] [cvs] commit: jonah/lib Jonah.php
Jan Schneider
jan at horde.org
Mon Aug 11 22:02:23 UTC 2008
Zitat von Ben Klang <ben at alkaloid.net>:
> On Aug 11, 2008, at 3:40 PM, Ben Klang wrote:
>
>> On Aug 6, 2008, at 6:07 AM, Jan Schneider wrote:
>>
>>> jan 2008-08-06 06:07:34 EDT
>>>
>>> Modified files:
>>> lib Jonah.php
>>> Log:
>>> Fix return type.
>>>
>> This actually reverts the intent of my original commit. The
>> problem is that there are calls within Jonah that treat the return
>> of Jonah::checkPermissions() as a boolean. The particular case I
>> found was that the Jonah::getMenu() call looks for the user to be
>> an admin before presenting the Feed menu icons. The problem is
>> that because $in is specified as an empty array (or rather, it's
>> unspecified and defaults to an empty array) the return type is an
>> empty array which appears as a boolean false, even though the user
>> is both a Horde administrator and a Jonah administrator
>> (jonah:admin permission).
>>
>> So which needs to change: the return type of
>> Jonah::checkPermissions() or the caller to Jonah::checkPermissions()?
>>
> Whoops, I now see that the email to which I replied actually came
> before my commit. I guess the question still stands, though the
> change I committed today effectively reverted your commit on August
> 6th. Unless I hear otherwise I'll leave it as returning true, since
> it works and was the original behavior.
It breaks stuff because if you pass an empty array, you will get a
false back, causing errors when trying to later loop on it. Either can
be changed. checkPermissions() to explicitly check for a passed
boolean, or the caller.
Jan.
--
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/
More information about the dev
mailing list