iliaa           Sun May 29 12:51:26 2005 EDT

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/session        session.c 
  Log:
  Added an optional remove old session parameter to session_regenerate_id().
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1903&r2=1.1904&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1903 php-src/NEWS:1.1904
--- php-src/NEWS:1.1903 Fri May 27 13:46:42 2005
+++ php-src/NEWS        Sun May 29 12:51:24 2005
@@ -2,6 +2,7 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2004, PHP 5.1.0
 - Upgraded PCRE library to version 5.0. (Andrei)
+- Added an optional remove old session parameter to session_regenerate_id(). 
(Ilia)
 - Added array type hinting. (Dmitry)
 - Removed php_check_syntax() function which never worked properly. (Ilia)
 - Removed garbage manager in Zend Engine which results in more aggressive
http://cvs.php.net/diff.php/php-src/ext/session/session.c?r1=1.413&r2=1.414&ty=u
Index: php-src/ext/session/session.c
diff -u php-src/ext/session/session.c:1.413 php-src/ext/session/session.c:1.414
--- php-src/ext/session/session.c:1.413 Mon May 23 02:46:25 2005
+++ php-src/ext/session/session.c       Sun May 29 12:51:25 2005
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: session.c,v 1.413 2005/05/23 06:46:25 sniper Exp $ */
+/* $Id: session.c,v 1.414 2005/05/29 16:51:25 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1462,12 +1462,24 @@
 }
 /* }}} */
 
-/* {{{ proto bool session_regenerate_id()
-   Update the current session id with a newly generated one. */
+/* {{{ proto bool session_regenerate_id([bool delete_old_session])
+   Update the current session id with a newly generated one. If 
delete_old_session is set to true, remove the old session. */
 PHP_FUNCTION(session_regenerate_id)
 {
+       zend_bool del_ses = 0;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &del_ses) == 
FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
        if (PS(session_status) == php_session_active) {
-               if (PS(id)) efree(PS(id));
+               if (PS(id)) {
+                       if (del_ses && PS(mod)->s_destroy(&PS(mod_data), PS(id) 
TSRMLS_CC) == FAILURE) {
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Session object destruction failed");
+                               RETURN_FALSE;
+                       }
+                       efree(PS(id));
+               }
        
                PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);
 

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

Reply via email to