sas Thu Oct 3 00:53:06 2002 EDT
Modified files:
/php4/ext/session session.c
Log:
Align behaviour with 4.2 with regard to register_globals=1
session_register("c");
unset($c);
$c = time();
If a user unsets a global session variable, it is not a reference
to a $_SESSION slot anymore.
During serialization, PHP 4.2 will not find the respective entry in
$_SESSION and fall back to the global sym table.
Index: php4/ext/session/session.c
diff -u php4/ext/session/session.c:1.325 php4/ext/session/session.c:1.326
--- php4/ext/session/session.c:1.325 Wed Oct 2 23:23:02 2002
+++ php4/ext/session/session.c Thu Oct 3 00:53:05 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: session.c,v 1.325 2002/10/03 03:23:02 sas Exp $ */
+/* $Id: session.c,v 1.326 2002/10/03 04:53:05 sas Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -317,12 +317,32 @@
int php_get_session_var(char *name, size_t namelen, zval ***state_var TSRMLS_DC)
{
+ int ret = FAILURE;
+
IF_SESSION_VARS() {
- return zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name,
+ ret = zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name,
namelen+1, (void **) state_var);
+
+ /*
+ * If register_globals is enabled, and
+ * if there is an entry for the slot in $_SESSION, and
+ * if that entry is still set to NULL, and
+ * if the global var exists, then
+ * we prefer the same key in the global sym table
+ */
+
+ if (PG(register_globals) && ret == SUCCESS
+ && Z_TYPE_PP(*state_var) == IS_NULL) {
+ zval **tmp;
+
+ if (zend_hash_find(&EG(symbol_table), name, namelen + 1,
+ (void **) &tmp) == SUCCESS) {
+ *state_var = tmp;
+ }
+ }
}
- return FAILURE;
+ return ret;
}
#define PS_BIN_NR_OF_BITS 8
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php