Commit:    b794cce4fd4a6158002f3e8a814a30891cefbcde
Author:    Leigh <lei...@gmail.com>         Tue, 26 Jun 2012 14:57:10 +0100
Committer: Arpad Ray <array...@gmail.com>      Thu, 27 Jun 2013 13:06:22 +0100
Parents:   074c26a68b9484cd51734a70bb91b8afb585c212
Branches:  master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=b794cce4fd4a6158002f3e8a814a30891cefbcde

Log:
Tests, fixes and optimisations

* Amended existing tests to cater for new functionality.
* Implemented fixes and optimisations recommended by NikiC
* Added create_sid to the registered interface. This was breaking
tests. It also now breaks BC for people implementing the interface
directly instead of extending the class.

Changed paths:
  M  ext/session/mod_user.h
  M  ext/session/mod_user_class.c
  M  ext/session/session.c
  M  ext/session/tests/session_set_save_handler_class_002.phpt
  M  ext/session/tests/session_set_save_handler_iface_001.phpt


Diff:
diff --git a/ext/session/mod_user.h b/ext/session/mod_user.h
index fd149cc..6b2998c 100644
--- a/ext/session/mod_user.h
+++ b/ext/session/mod_user.h
@@ -24,6 +24,6 @@
 extern ps_module ps_mod_user;
 #define ps_user_ptr &ps_mod_user
 
-PS_FUNCS(user);
+PS_FUNCS_SID(user);
 
 #endif
diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c
index 340c2ca..ea53af9 100644
--- a/ext/session/mod_user_class.c
+++ b/ext/session/mod_user_class.c
@@ -148,12 +148,12 @@ PHP_METHOD(SessionHandler, create_sid)
 {
        char *id;
 
-       zend_parse_parameters_none();
+       if (zend_parse_parameters_none() == FAILURE) {
+           return;
+       }
 
        id = PS(default_mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);
 
-       RETVAL_STRING(id, 1);
-       efree(id);
-       return;
+       RETURN_STRING(id, 0);
 }
 /* }}} */
diff --git a/ext/session/session.c b/ext/session/session.c
index 4b93ffa..d8de576 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -2083,6 +2083,7 @@ static const zend_function_entry 
php_session_iface_functions[] = {
        PHP_ABSTRACT_ME(SessionHandlerInterface, write, 
arginfo_session_class_write)
        PHP_ABSTRACT_ME(SessionHandlerInterface, destroy, 
arginfo_session_class_destroy)
        PHP_ABSTRACT_ME(SessionHandlerInterface, gc, arginfo_session_class_gc)
+       PHP_ABSTRACT_ME(SessionHandlerInterface, create_sid, 
arginfo_session_class_create_sid)
        { NULL, NULL, NULL }
 };
 /* }}} */
@@ -2096,7 +2097,6 @@ static const zend_function_entry 
php_session_class_functions[] = {
        PHP_ME(SessionHandler, write, arginfo_session_class_write, 
ZEND_ACC_PUBLIC)
        PHP_ME(SessionHandler, destroy, arginfo_session_class_destroy, 
ZEND_ACC_PUBLIC)
        PHP_ME(SessionHandler, gc, arginfo_session_class_gc, ZEND_ACC_PUBLIC)
-/* Added to the class but not the interface, to maintain backwards 
compatibility */
        PHP_ME(SessionHandler, create_sid, arginfo_session_class_create_sid, 
ZEND_ACC_PUBLIC)
        { NULL, NULL, NULL }
 };
diff --git a/ext/session/tests/session_set_save_handler_class_002.phpt 
b/ext/session/tests/session_set_save_handler_class_002.phpt
index 6fb831f..4195a16 100644
--- a/ext/session/tests/session_set_save_handler_class_002.phpt
+++ b/ext/session/tests/session_set_save_handler_class_002.phpt
@@ -53,6 +53,10 @@ class MySession2 extends SessionHandler {
                }
                return true;
        }
+       
+       public function create_sid() {
+               return parent::create_sid();
+       }
 }
 
 $handler = new MySession2;
diff --git a/ext/session/tests/session_set_save_handler_iface_001.phpt 
b/ext/session/tests/session_set_save_handler_iface_001.phpt
index 39a4b99..0576341 100644
--- a/ext/session/tests/session_set_save_handler_iface_001.phpt
+++ b/ext/session/tests/session_set_save_handler_iface_001.phpt
@@ -53,6 +53,10 @@ class MySession2 implements SessionHandlerInterface {
                }
                return true;
        }
+       
+       public function create_sid() {
+               return md5(mt_rand());
+       }
 }
 
 $handler = new MySession2;


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

Reply via email to