Pim
Pim

Reputation: 2128

Error on Zend_Session::namespaceUnset('Default');

I'm fairly new to Zend and I think this question won't be so hard to answer.

I'd like to unset my entire session namespace (called 'Default'), and I've found a possible answer here, but when I use the following line of code Zend_Session::namespaceUnset('Default'); I get this error: Zend_Session is currently marked as read-only.

Hopefully someone can help me out.

Upvotes: 1

Views: 3087

Answers (1)

Layke
Layke

Reputation: 53106

If it is set to read-only, then you can remove the read-only, by called

$namespace->unlock();

Also, "Default" is the default namespace name. I always change this to something else. You can also check if the $namespace you are trying to use is locked by using:

$namespace->isLocked(). This will return a boolean true/false of the status of the namespace.

So... what you might have is this (from docs):

$userProfileNamespace = new Zend_Session_Namespace('userProfileNamespace');

// marking session as read only locked
$userProfileNamespace->lock();

// unlocking read-only lock
if ($userProfileNamespace->isLocked()) {
    $userProfileNamespace->unLock();
}

Upvotes: 1

Related Questions