diff options
author | Leigh <leight@gmail.com> | 2012-06-15 15:06:47 +0100 |
---|---|---|
committer | Arpad Ray <arraypad@gmail.com> | 2013-06-27 13:06:22 +0100 |
commit | 074c26a68b9484cd51734a70bb91b8afb585c212 (patch) | |
tree | 7a52a26fd81c2a4d645b3ee96c118cba1fcbe38d /ext/session/mod_user_class.c | |
parent | eb190bb57158e13a6ddcf8da0da7f7c79b52f2be (diff) | |
download | php-git-074c26a68b9484cd51734a70bb91b8afb585c212.tar.gz |
Add create_sid to session_set_save_handler and SessionHandler
A lot of code already existed to allow a custom create_sid handler, but
lacked a specific implementation.
Therefore I have added a 7th (optional) argument
session_set_save_handler, to allow a user function to be supplied for
session id generation.
If a create_sid function is not supplied, the default function is
called in its absence to preserve backwards compatibility.
Likewise create_sid only added to SessionHandler class, and not the
interface to maintain backwards compatibility. If the result is not
overridden, the default is called.
Diffstat (limited to 'ext/session/mod_user_class.c')
-rw-r--r-- | ext/session/mod_user_class.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c index 1ed1e7bbd5..340c2ca97a 100644 --- a/ext/session/mod_user_class.c +++ b/ext/session/mod_user_class.c @@ -141,3 +141,19 @@ PHP_METHOD(SessionHandler, gc) RETVAL_BOOL(SUCCESS == PS(default_mod)->s_gc(&PS(mod_data), maxlifetime, &nrdels TSRMLS_CC)); } /* }}} */ + +/* {{{ proto char SessionHandler::create_sid() + Wraps the old create_sid handler */ +PHP_METHOD(SessionHandler, create_sid) +{ + char *id; + + zend_parse_parameters_none(); + + id = PS(default_mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC); + + RETVAL_STRING(id, 1); + efree(id); + return; +} +/* }}} */ |