diff options
Diffstat (limited to 'ext/session/mod_user_class.c')
-rw-r--r-- | ext/session/mod_user_class.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c index ea53af9ebe..7e2960cc32 100644 --- a/ext/session/mod_user_class.c +++ b/ext/session/mod_user_class.c @@ -1,8 +1,8 @@ /* +----------------------------------------------------------------------+ - | PHP Version 5 | + | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | + | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -39,7 +39,7 @@ PHP_METHOD(SessionHandler, open) { char *save_path = NULL, *session_name = NULL; - int save_path_len, session_name_len; + size_t save_path_len, session_name_len; PS_SANITY_CHECK; @@ -71,23 +71,21 @@ PHP_METHOD(SessionHandler, close) Wraps the old read handler */ PHP_METHOD(SessionHandler, read) { - char *key, *val; - int key_len, val_len; + zend_string *val; + zend_string *key; PS_SANITY_CHECK_IS_OPEN; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &key) == FAILURE) { return; } - if (PS(default_mod)->s_read(&PS(mod_data), key, &val, &val_len TSRMLS_CC) == FAILURE) { + if (PS(default_mod)->s_read(&PS(mod_data), key, &val TSRMLS_CC) == FAILURE) { RETVAL_FALSE; return; } - RETVAL_STRINGL(val, val_len, 1); - efree(val); - return; + RETURN_STR(val); } /* }}} */ @@ -95,16 +93,15 @@ PHP_METHOD(SessionHandler, read) Wraps the old write handler */ PHP_METHOD(SessionHandler, write) { - char *key, *val; - int key_len, val_len; + zend_string *key, *val; PS_SANITY_CHECK_IS_OPEN; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &key, &key_len, &val, &val_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &key, &val) == FAILURE) { return; } - RETVAL_BOOL(SUCCESS == PS(default_mod)->s_write(&PS(mod_data), key, val, val_len TSRMLS_CC)); + RETURN_BOOL(SUCCESS == PS(default_mod)->s_write(&PS(mod_data), key, val TSRMLS_CC)); } /* }}} */ @@ -112,16 +109,15 @@ PHP_METHOD(SessionHandler, write) Wraps the old destroy handler */ PHP_METHOD(SessionHandler, destroy) { - char *key; - int key_len; + zend_string *key; PS_SANITY_CHECK_IS_OPEN; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &key) == FAILURE) { return; } - RETVAL_BOOL(SUCCESS == PS(default_mod)->s_destroy(&PS(mod_data), key TSRMLS_CC)); + RETURN_BOOL(SUCCESS == PS(default_mod)->s_destroy(&PS(mod_data), key TSRMLS_CC)); } /* }}} */ @@ -129,7 +125,7 @@ PHP_METHOD(SessionHandler, destroy) Wraps the old gc handler */ PHP_METHOD(SessionHandler, gc) { - long maxlifetime; + zend_long maxlifetime; int nrdels; PS_SANITY_CHECK_IS_OPEN; @@ -138,7 +134,7 @@ PHP_METHOD(SessionHandler, gc) return; } - RETVAL_BOOL(SUCCESS == PS(default_mod)->s_gc(&PS(mod_data), maxlifetime, &nrdels TSRMLS_CC)); + RETURN_BOOL(SUCCESS == PS(default_mod)->s_gc(&PS(mod_data), maxlifetime, &nrdels TSRMLS_CC)); } /* }}} */ @@ -146,14 +142,16 @@ PHP_METHOD(SessionHandler, gc) Wraps the old create_sid handler */ PHP_METHOD(SessionHandler, create_sid) { - char *id; + zend_string *id; + + PS_SANITY_CHECK; if (zend_parse_parameters_none() == FAILURE) { return; } - id = PS(default_mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC); + id = PS(default_mod)->s_create_sid(&PS(mod_data) TSRMLS_CC); - RETURN_STRING(id, 0); + RETURN_STR(id); } /* }}} */ |