summaryrefslogtreecommitdiff
path: root/ext/session/mod_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/session/mod_user.c')
-rw-r--r--ext/session/mod_user.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index e6f162855a..0cdbaf96f9 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -85,7 +85,16 @@ PS_OPEN_FUNC(user)
ZVAL_STRING(&args[0], (char*)save_path);
ZVAL_STRING(&args[1], (char*)session_name);
- ps_call_handler(&PSF(open), 2, args, &retval);
+ zend_try {
+ ps_call_handler(&PSF(open), 2, args, &retval);
+ } zend_catch {
+ PS(session_status) = php_session_none;
+ if (!Z_ISUNDEF(retval)) {
+ zval_ptr_dtor(&retval);
+ }
+ zend_bailout();
+ } zend_end_try();
+
PS(mod_user_implemented) = 1;
FINISH;
@@ -167,13 +176,22 @@ PS_DESTROY_FUNC(user)
PS_GC_FUNC(user)
{
zval args[1];
- STDVARS;
+ zval retval;
ZVAL_LONG(&args[0], maxlifetime);
ps_call_handler(&PSF(gc), 1, args, &retval);
- FINISH;
+ if (Z_TYPE(retval) == IS_LONG) {
+ convert_to_long(&retval);
+ return Z_LVAL(retval);
+ }
+ /* This is for older API compatibility */
+ if (Z_TYPE(retval) == IS_TRUE) {
+ return 1;
+ }
+ /* Anything else is some kind of error */
+ return -1; // Error
}
PS_CREATE_SID_FUNC(user)
@@ -191,12 +209,12 @@ PS_CREATE_SID_FUNC(user)
}
zval_ptr_dtor(&retval);
} else {
- php_error_docref(NULL, E_ERROR, "No session id returned by function");
+ zend_throw_error(NULL, "No session id returned by function");
return NULL;
}
if (!id) {
- php_error_docref(NULL, E_ERROR, "Session id must be a string");
+ zend_throw_error(NULL, "Session id must be a string");
return NULL;
}