Zend Framework Forum

Go Back   Zend Framework Forum > Zend Framework Components > Authentication & Authorization

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-30-2009, 11:50 PM
Junior Member
 
Join Date: Jan 2009
Posts: 17
Default unsset zend_session variable?

For some reason I can't unset a session variable. Any ideas?

Code:
if($session->forum_updates[$board['id']] >= 1) {
     unset($session->forum_updates[$board['id']]);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-01-2009, 12:39 AM
Member
 
Join Date: Oct 2008
Posts: 65
Default

If you only want to unset the $board['id'] value in forum_updates, that should work. If you can't get it to work, try getting rid of the if... statement and the $board variable.

[PHP]
$session = new Zend_Session_Namespace('session');

$session->forum_updates = array();
$session->forum_updates['id'] = 14;
var_dump($session->forum_updates['id']); // outputs int(14)
unset($session->forum_updates['id']);
var_dump($session->forum_updates['id']); // outputs undefined
var_dump($session->forum_updates); // outputs array(0) { }
[/PHP]

If you want to unset all of forum_updates then:
[PHP]
$session->__unset('forum_updates');
[/PHP]
__________________
Mark Belanger
http://www.shoreboat.com | http://twitter.com/shoreboat
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-01-2009, 02:40 AM
Junior Member
 
Join Date: Jan 2009
Posts: 17
Default

Okay, I got it working. The problem was I kept setting the variable so it kept getting reset.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT. The time now is 01:07 AM.


Designed by: Miner Skinz Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0