[dev] [commits] Horde branch master updated. 85e306b9042c49634b25d0a3d1573366576fc165

Chuck Hagenbuch chuck at horde.org
Fri Oct 22 02:18:27 UTC 2010


Quoting Michael M Slusarz <slusarz at horde.org>:

> Quoting Chuck Hagenbuch <chuck at horde.org>:
>
>> commit 85e306b9042c49634b25d0a3d1573366576fc165
>> Author: Chuck Hagenbuch <chuck at horde.org>
>> Date:   Thu Oct 21 15:23:46 2010 -0400
>>
>>    Don't throw a warning if the global doesn't exist
>>
>> framework/Core/lib/Horde/Core/Browser.php |    7 +++++--
>> 1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> http://git.horde.org/diff.php/framework/Core/lib/Horde/Core/Browser.php?rt=horde-git&r1=a7c7c74a95a0a3947850d2f9b4bc51365b69c17a&r2=85e306b9042c49634b25d0a3d1573366576fc165
>
> There's no need to check the indices of a session variable - if the  
> index doesn't exist, Horde_Session will automatically return null  
> instead of throwing an undefined index error.
>
> It must be $GLOBALS['session'] itself that doesn't exist so the  
> check should be for that.  (Not a big deal, but figured it was a  
> good place to identify an advantage of Horde_Session since I haven't  
> finished writing the docs yet).

Is there a reason that Horde_Session uses a global with array  
semantics? Makes it feel very magic, and not being familiar with its  
internals, I had no way of knowing the above - nor does anyone looking  
at how it's used. In fact I didn't even know that $GLOBALS['session']  
was a Horde_Session object.

I know we need to keep the global for a while at least, and injecting  
it everywhere is going to be a long-haul project, but is there a  
reason not to at least use method-call semantics on it to make it  
clearer what you're interacting with?

-chuck


More information about the dev mailing list