summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2001-11-24 02:14:45 +0000
committerZeev Suraski <zeev@php.net>2001-11-24 02:14:45 +0000
commit8c1f1f15c5487b74c9954312b990b4f7393c90ee (patch)
tree29e39b0a733ac33060ba18e95982191b2c243874
parent09f96051dd6d0e210f8827e0a7920ef24b09045a (diff)
downloadphp-git-8c1f1f15c5487b74c9954312b990b4f7393c90ee.tar.gz
Entries registered with session_register() and altered by changing
$_SESSION (or $HTTP_SESSION_VARS) were not properly saved. Fixed.
-rw-r--r--ext/session/session.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/session/session.c b/ext/session/session.c
index ab9d3a3f90..676ff51899 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -261,7 +261,6 @@ typedef struct {
void php_set_session_var(char *name, size_t namelen, zval *state_val, php_unserialize_data_t *var_hash TSRMLS_DC)
{
-
if (PG(register_globals)) {
zval **old_symbol;
if (zend_hash_find(&EG(symbol_table),name,namelen+1,(void *)&old_symbol) == SUCCESS) {
@@ -295,14 +294,15 @@ void php_set_session_var(char *name, size_t namelen, zval *state_val, php_unseri
int php_get_session_var(char *name, size_t namelen, zval ***state_var TSRMLS_DC)
{
- HashTable *ht = &EG(symbol_table);
-
- if (!PG(register_globals))
- ht = PS(http_session_vars) ? Z_ARRVAL_P(PS(http_session_vars)) : NULL;
-
- if (!ht) return HASH_KEY_NON_EXISTANT;
-
- return zend_hash_find(ht, name, namelen + 1, (void **)state_var);
+ if (PS(http_session_vars)) {
+ if (zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name, namelen+1, (void **) state_var)==SUCCESS) {
+ return SUCCESS;
+ }
+ } else if (!PG(register_globals)) {
+ /* register_globals is disabled, but we don't have http_session_vars */
+ return HASH_KEY_NON_EXISTANT;
+ }
+ return zend_hash_find(&EG(symbol_table), name, namelen+1, (void **) state_var);
}
#define PS_BIN_NR_OF_BITS 8