summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--ext/session/mod_user.c22
2 files changed, 17 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 50ae046786..1badfb8579 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ PHP NEWS
- Standard:
. Removed call_user_method() and call_user_method_array() functions. (Kalle)
+ . Fix user session handlers (See rfc:session.user.return-value). (Sara)
- XSL:
. Fixed bug #64776 (The XSLT extension is not thread safe). (Mike)
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index 5573d4cdfd..6720987580 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -68,12 +68,22 @@ static zval *ps_call_handler(zval *func, int argc, zval **argv TSRMLS_DC)
#define PSF(a) PS(mod_user_names).name.ps_##a
-#define FINISH \
- if (retval) { \
- convert_to_long(retval); \
- ret = Z_LVAL_P(retval); \
- zval_ptr_dtor(&retval); \
- } \
+#define FINISH \
+ if (retval) { \
+ if (Z_TYPE_P(retval) == IS_BOOL) { \
+ ret = Z_BVAL_P(retval) ? SUCCESS : FAILURE; \
+ } else if ((Z_TYPE_P(retval) == IS_LONG) && (Z_LVAL_P(retval) == -1)) { \
+ /* BC for clever users - Deprecate me */ \
+ ret = FAILURE; \
+ } else if ((Z_TYPE_P(retval) == IS_LONG) && (Z_LVAL_P(retval) == 0)) { \
+ /* BC for clever users - Deprecate me */ \
+ ret = SUCCESS; \
+ } else { \
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session callback expects true/false return value"); \
+ ret = FAILURE; \
+ } \
+ zval_ptr_dtor(&retval); \
+ } \
return ret
PS_OPEN_FUNC(user)