|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2001-12-06 14:40 UTC] info at somnioworld dot com
 There appears to be an issue with unsetting variables in a session. I have an object variable that is stored in the session and when I attempt to unset the value via unset(object) and session_unregister(object) and test if(isset(object)) to see if it is set in a seperate script the test passes. In PHP 4.05 I did not encounter this problem. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 22:00:01 2025 UTC | 
Sample script: // script to create session variable session_start(); session_register("objectA"); $objectA = new classA(); // script to unset session variable session_start(); session_unregister("objectA"); unset($objectA); // script to test for session variable session_start(); if(isset($objectA)) { echo "TEST PASSED"; } Doing a session_destroy() then unset() of all the session variables seems to work, but in the above code I wish to just unset() a single variable in the session but keep the session and the remaining variables alive.Are you sure you did that after the fix? file /ext/session/php_session.h should include this (around line 168): #define PS_DEL_VARL(name,namelen) \ zend_hash_del(&PS(vars), name, namelen+1); \ if (PS(http_session_vars)) { \ zend_hash_del(Z_ARRVAL_P(PS(http_session_vars)), name, namelen+1); \ } Does it do that, and did you rebuild from a fresh tree? DerickIt is certainly in the php 4.2.0 cvs tree, as I just downloaded it here. with the instructions on that site, you should have the correct version too (with the fix). Can you please check again of lines 169-173 in php4/ext/session/php_session.h have these lines of codE: #define PS_DEL_VARL(name,namelen) \ zend_hash_del(&PS(vars), name, namelen+1); \ if (PS(http_session_vars)) { \ zend_hash_del(Z_ARRVAL_P(PS(http_session_vars)), name, namelen+1); \ } regards, Derick