iliaa           Sun Dec 14 18:24:52 2003 EDT

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/session        session.c 
  Log:
  Fixed bug #24693 (Allow session.use_trans_sid to be enabled/disabled from
  inside the script).
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1535 php-src/NEWS:1.1536
--- php-src/NEWS:1.1535 Sat Dec 13 13:55:52 2003
+++ php-src/NEWS        Sun Dec 14 18:24:50 2003
@@ -47,6 +47,8 @@
   has no properties (NULL hashtable)). (Wez)
 - Fixed bug #25664 (COM crashes when calling a Delphi implementations of 
   ITypeInfo). (Wez)
+- Fixed bug #24693 (Allow session.use_trans_sid to be enabled/disabled from
+  inside the script). (Ilia)
 - Fixed bug #24394 (Serializing cross-referenced objects causes segfault).
   (Moriyoshi)
 
Index: php-src/ext/session/session.c
diff -u php-src/ext/session/session.c:1.379 php-src/ext/session/session.c:1.380
--- php-src/ext/session/session.c:1.379 Sun Dec  7 09:29:43 2003
+++ php-src/ext/session/session.c       Sun Dec 14 18:24:50 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: session.c,v 1.379 2003/12/07 14:29:43 derick Exp $ */
+/* $Id: session.c,v 1.380 2003/12/14 23:24:50 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -86,12 +86,16 @@
 static ps_module *_php_find_ps_module(char *name TSRMLS_DC);
 static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC);
 
+#define SESSION_CHECK_ACTIVE_STATE     \
+       if (PS(session_status) == php_session_active) { \
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "A session is active. You 
cannot change the session module's ini settings at this time.");  \
+               return FAILURE; \
+       }       \
+
 static PHP_INI_MH(OnUpdateSaveHandler)
 {
-       if (PS(session_status) == php_session_active) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "A session is active. You 
cannot change the session module's ini settings at this time.");
-               return FAILURE;
-       }
+       SESSION_CHECK_ACTIVE_STATE;
+
        PS(mod) = _php_find_ps_module(new_value TSRMLS_CC);
 
        if (PG(modules_activated) && !PS(mod)) {
@@ -101,12 +105,23 @@
        return SUCCESS;
 }
 
-static PHP_INI_MH(OnUpdateSerializer)
+static PHP_INI_MH(OnUpdateTransSid)
 {
-       if (PS(session_status) == php_session_active) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "A session is active. You 
cannot change the session module's ini settings at this time.");
-               return FAILURE;
+       SESSION_CHECK_ACTIVE_STATE;
+
+       if (!strncasecmp(new_value, "on", sizeof("on"))) {
+               PS(use_trans_sid) = (zend_bool) 1;
+       } else {
+               PS(use_trans_sid) = (zend_bool) atoi(new_value);
        }
+
+       return SUCCESS;
+}
+
+static PHP_INI_MH(OnUpdateSerializer)
+{
+       SESSION_CHECK_ACTIVE_STATE;
+
        PS(serializer) = _php_find_ps_serializer(new_value TSRMLS_CC);
 
        if (PG(modules_activated) && !PS(serializer)) {
@@ -141,7 +156,7 @@
        STD_PHP_INI_ENTRY("session.entropy_length",     "0",         PHP_INI_ALL, 
OnUpdateLong,    entropy_length,     php_ps_globals,    ps_globals)
        STD_PHP_INI_ENTRY("session.cache_limiter",      "nocache",   PHP_INI_ALL, 
OnUpdateString, cache_limiter,      php_ps_globals,    ps_globals)
        STD_PHP_INI_ENTRY("session.cache_expire",       "180",       PHP_INI_ALL, 
OnUpdateLong,    cache_expire,       php_ps_globals,    ps_globals)
-       STD_PHP_INI_BOOLEAN("session.use_trans_sid",    "0",         
PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool,   use_trans_sid,      php_ps_globals,    
ps_globals)
+       PHP_INI_ENTRY("session.use_trans_sid",          "0",         PHP_INI_ALL, 
OnUpdateTransSid)
        STD_PHP_INI_ENTRY("session.hash_function",      "0",         PHP_INI_ALL, 
OnUpdateLong,    hash_func,          php_ps_globals,    ps_globals)
        STD_PHP_INI_ENTRY("session.hash_bits_per_character",      "4",         
PHP_INI_ALL, OnUpdateLong,    hash_bits_per_character,          php_ps_globals,    
ps_globals)
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to