cvs: php4 /ext/session php_session.h

From: Date: Thu, 15 Aug 2002 21:44:44 +0000
Subject: cvs: php4 /ext/session php_session.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13393@lists.php.net to get a copy of this message
zeev Thu Aug 15 17:44:44 2002 EDT Modified files: /php4/ext/session php_session.h Log: Make unset($_SESSION['foo']) actually remove the variable from the session, if register_globals is off. Index: php4/ext/session/php_session.h diff -u php4/ext/session/php_session.h:1.80 php4/ext/session/php_session.h:1.81 --- php4/ext/session/php_session.h:1.80 Wed Jun 12 04:18:33 2002 +++ php4/ext/session/php_session.h Thu Aug 15 17:44:44 2002 @@ -186,8 +186,14 @@ PHPAPI void php_session_set_id(char *id TSRMLS_DC); PHPAPI void php_session_start(TSRMLS_D); -#define PS_ADD_VARL(name,namelen) \ - zend_hash_add_empty_element(&PS(vars), name, namelen + 1) +#define PS_ADD_VARL(name,namelen) \ + zend_hash_add_empty_element(&PS(vars), name, namelen + 1); \ + if (PS(http_session_vars)) { \ + zval *empty_var; \ + \ + ALLOC_INIT_ZVAL(empty_var); \ + zend_hash_add(Z_ARRVAL_P(PS(http_session_vars)), name, namelen+1, &empty_var, sizeof(zval *), NULL); \ + } #define PS_ADD_VAR(name) PS_ADD_VARL(name, strlen(name)) @@ -205,13 +211,17 @@ zval **struc; #define PS_ENCODE_LOOP(code) \ - for (zend_hash_internal_pointer_reset(&PS(vars)); \ - zend_hash_get_current_key_ex(&PS(vars), &key, &key_length, &num_key, 0, NULL) == HASH_KEY_IS_STRING; \ - zend_hash_move_forward(&PS(vars))) { \ - key_length--; \ - if (php_get_session_var(key, key_length, &struc TSRMLS_CC) == SUCCESS) { \ - code; \ - } \ + { \ + HashTable *_ht = (PS(http_session_vars) ? Z_ARRVAL_P(PS(http_session_vars)) : &PS(vars)); \ + \ + for (zend_hash_internal_pointer_reset(_ht); \ + zend_hash_get_current_key_ex(_ht, &key, &key_length, &num_key, 0, NULL) == HASH_KEY_IS_STRING; \ + zend_hash_move_forward(_ht)) { \ + key_length--; \ + if (php_get_session_var(key, key_length, &struc TSRMLS_CC) == SUCCESS) { \ + code; \ + } \ + } \ } ZEND_EXTERN_MODULE_GLOBALS(ps);

« previous php.cvs (#13393) next »