cvs: php4 /ext/session session.c

From: Date: Thu, 17 Jan 2002 18:56:11 +0000
Subject: cvs: php4 /ext/session session.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9079@lists.php.net to get a copy of this message
thies Thu Jan 17 13:56:11 2002 EDT Modified files: /php4/ext/session session.c Log: @ - 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. Index: php4/ext/session/session.c diff -u php4/ext/session/session.c:1.270 php4/ext/session/session.c:1.271 --- php4/ext/session/session.c:1.270 Wed Jan 16 18:24:37 2002 +++ php4/ext/session/session.c Thu Jan 17 13:56:11 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: session.c,v 1.270 2002/01/16 23:24:37 yohgaki Exp $ */ +/* $Id: session.c,v 1.271 2002/01/17 18:56:11 thies Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1374,13 +1374,15 @@ 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. */

« previous php.cvs (#9079) next »