summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorThies C. Arntzen <thies@php.net>2002-01-17 18:56:11 +0000
committerThies C. Arntzen <thies@php.net>2002-01-17 18:56:11 +0000
commit53f8b2d28b2d38da4eb6e08069c13fa85aa7a0ed (patch)
treebdda4eaed37a2c34ecb94d83eaedd859cfddc4e2 /ext
parentdadf411b8d2d5b0d1b246133687b4fa9da1fa71c (diff)
downloadphp-git-53f8b2d28b2d38da4eb6e08069c13fa85aa7a0ed.tar.gz
@ - Don't touch any globals in session_unset() if register_globals is set
@ to off. (Thies) guys, shoot me if i'm wrong, but when we have set register_globals to off we should _not_ touch any global variables at any time, right? so all session register/unregister should only work on $HTTP_SESSION_VARS and $_SESSION. this patch fixes at least one spot where we were touching globals even with register_globals set to off.
Diffstat (limited to 'ext')
-rw-r--r--ext/session/session.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/session/session.c b/ext/session/session.c
index 88d5d2574a..69836bff53 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -1374,13 +1374,15 @@ PHP_FUNCTION(session_unset)
if (PS(session_status) == php_session_none)
RETURN_FALSE;
-
- for (zend_hash_internal_pointer_reset(&PS(vars));
- zend_hash_get_current_key(&PS(vars), &variable, &num_key, 0) == HASH_KEY_IS_STRING;
- zend_hash_move_forward(&PS(vars))) {
- if (zend_hash_find(&EG(symbol_table), variable, strlen(variable) + 1, (void **) &tmp)
- == SUCCESS)
- zend_hash_del(&EG(symbol_table), variable, strlen(variable) + 1);
+
+ if (PG(register_globals)) {
+ for (zend_hash_internal_pointer_reset(&PS(vars));
+ zend_hash_get_current_key(&PS(vars), &variable, &num_key, 0) == HASH_KEY_IS_STRING;
+ zend_hash_move_forward(&PS(vars))) {
+ if (zend_hash_find(&EG(symbol_table), variable, strlen(variable) + 1, (void **) &tmp)
+ == SUCCESS)
+ zend_hash_del(&EG(symbol_table), variable, strlen(variable) + 1);
+ }
}
/* Clean $HTTP_SESSION_VARS. */