diff options
| author | Sascha Schumann <sas@php.net> | 2002-10-03 03:23:02 +0000 |
|---|---|---|
| committer | Sascha Schumann <sas@php.net> | 2002-10-03 03:23:02 +0000 |
| commit | b9077e5a9de74faab97c1f671fed0934537a7b2b (patch) | |
| tree | 1aee6ae4a073700063408bcde8abac989f92a125 /ext/session/php_session.h | |
| parent | bec4574f575a4536320da5753fa1221368947534 (diff) | |
| download | php-git-b9077e5a9de74faab97c1f671fed0934537a7b2b.tar.gz | |
Nuke PS(vars), we keep the state of registered session variables now
completely in PS(http_session_vars). This avoids bugs which are caused
by a lack of synchronization between the two hashes. We also don't need
to worry about prioritizing one of them.
Add session.bug_compat_42 and session.bug_compat_warn which are enabled
by default. The logic behind bug_compat_42:
IF bug_compat_42 is on, and
IF register_globals is off, and
IF any value of $_SESSION["key"] is NULL, and
IF there is a global variable $key, then
$_SESSION["key"] is set to $key.
The extension emits this warning once per script, unless told otherwise.
"Your script possibly relies on a session side-effect which existed until
PHP 4.2.3. Please be advised that the session extension does not consider
global variables as a source of data, unless register_globals is enabled.
You can disable this functionality and this warning by setting
session.bug_compat_42 or session.bug_compat_warn.
Diffstat (limited to 'ext/session/php_session.h')
| -rw-r--r-- | ext/session/php_session.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/session/php_session.h b/ext/session/php_session.h index 8cb02bfa64..99da8efbbe 100644 --- a/ext/session/php_session.h +++ b/ext/session/php_session.h @@ -103,12 +103,13 @@ typedef struct _php_ps_globals { zend_bool cookie_secure; ps_module *mod; void *mod_data; - HashTable vars; php_session_status session_status; long gc_probability; long gc_maxlifetime; int module_number; long cache_expire; + long bug_compat; /* Whether to behave like PHP 4.2 and earlier */ + long bug_compat_warn; /* Whether to warn about it */ const struct ps_serializer_struct *serializer; zval *http_session_vars; zend_bool auto_start; @@ -188,14 +189,12 @@ PHPAPI void php_session_set_id(char *id TSRMLS_DC); PHPAPI void php_session_start(TSRMLS_D); #define PS_ADD_VARL(name,namelen) do { \ - zend_hash_add_empty_element(&PS(vars), name, namelen + 1); \ php_add_session_var(name, namelen TSRMLS_CC); \ } while (0) #define PS_ADD_VAR(name) PS_ADD_VARL(name, strlen(name)) #define PS_DEL_VARL(name,namelen) do { \ - zend_hash_del(&PS(vars), name, namelen+1); \ if (PS(http_session_vars)) { \ zend_hash_del(Z_ARRVAL_P(PS(http_session_vars)), name, namelen+1); \ } \ @@ -210,7 +209,7 @@ PHPAPI void php_session_start(TSRMLS_D); #define PS_ENCODE_LOOP(code) \ { \ - HashTable *_ht = (PS(http_session_vars) ? Z_ARRVAL_P(PS(http_session_vars)) : &PS(vars)); \ + HashTable *_ht = Z_ARRVAL_P(PS(http_session_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; \ |
