On Tuesday 25 Jan 2011 14:09:42 AmirBehzad Eslami wrote:
> Hi list,
> 
> Is it possible to unset a single variable in Zend_Registry?
> For example, I insert an authenticated user's details in Registry, using:
> 
>               Zend_Registry::set('authenticated_user', array(....));
> 
> When user logouts, I want to unset this index somehow.
> But there is no any method to unset! I don't want to replace the current
> value with an empty array(), I just want to remove the "authenticated_user"
> entirely.
> 
> Is there a way to unset a single index in Zend_Registry.
> Any ideas?

Zend_Registry extends ArrayObject, so isn't it possible to do something like 
this:

$registry = Zend_Registry::getInstance();
unset($registry['authenticated_user']);
or
Zend_Registry::getInstance()->offsetUnset('authenticated_user');

Didn't test them, but they should work.

Regards, Jurian
-- 
Jurian Sluiman
Soflomo - http://soflomo.com

Reply via email to