diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index bac6c4297d81d..36f9198166d50 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -168,12 +168,12 @@ static void ps_files_open(ps_files *data, const char *key)
ps_files_close(data);
if (php_session_valid_key(key) == FAILURE) {
- php_error_docref(NULL, E_WARNING, "The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'");
+ php_error_docref(NULL, E_WARNING, "Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, \"-\", and \",\" characters are allowed");
return;
}
if (!ps_files_path_create(buf, sizeof(buf), data, key)) {
- php_error_docref(NULL, E_WARNING, "Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d)", MAXPATHLEN);
+ php_error_docref(NULL, E_WARNING, "Failed to create session data file path. Too short session ID, invalid save_path or path length exceeds %d characters", MAXPATHLEN);
return;
}
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index c3e5c608aa928..b41b742cba87c 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -58,15 +58,18 @@ static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval)
} else if (Z_TYPE(retval) == IS_FALSE) { \
ret = FAILURE; \
} else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == -1)) { \
- /* BC for clever users - Deprecate me */ \
+ if (!EG(exception)) { \
+ php_error_docref(NULL, E_DEPRECATED, "Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \
+ } \
ret = FAILURE; \
} else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == 0)) { \
- /* BC for clever users - Deprecate me */ \
+ if (!EG(exception)) { \
+ php_error_docref(NULL, E_DEPRECATED, "Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \
+ } \
ret = SUCCESS; \
} else { \
if (!EG(exception)) { \
- php_error_docref(NULL, E_WARNING, \
- "Session callback expects true/false return value"); \
+ zend_type_error("Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \
} \
ret = FAILURE; \
zval_ptr_dtor(&retval); \
@@ -80,8 +83,7 @@ PS_OPEN_FUNC(user)
STDVARS;
if (Z_ISUNDEF(PSF(open))) {
- php_error_docref(NULL, E_WARNING,
- "user session functions not defined");
+ php_error_docref(NULL, E_WARNING, "User session functions are not defined");
return FAILURE;
}
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index 73f8bf31c8d20..c365975fb5f53 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -291,7 +291,7 @@ PHPAPI int php_session_reset_id(void);
HashTable *_ht = Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))); \
ZEND_HASH_FOREACH_KEY(_ht, num_key, key) { \
if (key == NULL) { \
- php_error_docref(NULL, E_NOTICE, \
+ php_error_docref(NULL, E_WARNING, \
"Skipping numeric key " ZEND_LONG_FMT, num_key);\
continue; \
} \
diff --git a/ext/session/session.c b/ext/session/session.c
index 9336c05be816c..4f12e447baa33 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -84,13 +84,13 @@ zend_class_entry *php_session_update_timestamp_iface_entry;
#define SESSION_CHECK_ACTIVE_STATE \
if (PS(session_status) == php_session_active) { \
- php_error_docref(NULL, E_WARNING, "A session is active. You cannot change the session module's ini settings at this time"); \
+ php_error_docref(NULL, E_WARNING, "Session ini settings cannot be changed when a session is active"); \
return FAILURE; \
}
#define SESSION_CHECK_OUTPUT_STATE \
if (SG(headers_sent) && stage != ZEND_INI_STAGE_DEACTIVATE) { \
- php_error_docref(NULL, E_WARNING, "Headers already sent. You cannot change the session module's ini settings at this time"); \
+ php_error_docref(NULL, E_WARNING, "Session ini settings cannot be changed after headers have already been sent"); \
return FAILURE; \
}
@@ -160,7 +160,9 @@ PHPAPI int php_session_destroy(void) /* {{{ */
if (PS(id) && PS(mod)->s_destroy(&PS(mod_data), PS(id)) == FAILURE) {
retval = FAILURE;
- php_error_docref(NULL, E_WARNING, "Session object destruction failed");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Session object destruction failed");
+ }
}
php_rshutdown_session_globals();
@@ -393,7 +395,9 @@ static int php_session_initialize(void) /* {{{ */
/* || PS(mod_data) == NULL */ /* FIXME: open must set valid PS(mod_data) with success */
) {
php_session_abort();
- php_error_docref(NULL, E_WARNING, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ }
return FAILURE;
}
@@ -405,14 +409,17 @@ static int php_session_initialize(void) /* {{{ */
PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
if (!PS(id)) {
php_session_abort();
- zend_throw_error(NULL, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ if (!EG(exception)) {
+ zend_throw_error(NULL, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ }
return FAILURE;
}
if (PS(use_cookies)) {
PS(send_cookie) = 1;
}
} else if (PS(use_strict_mode) && PS(mod)->s_validate_sid &&
- PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE) {
+ PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE
+ ) {
if (PS(id)) {
zend_string_release_ex(PS(id), 0);
}
@@ -435,7 +442,9 @@ static int php_session_initialize(void) /* {{{ */
if (PS(mod)->s_read(&PS(mod_data), PS(id), &val, PS(gc_maxlifetime)) == FAILURE) {
php_session_abort();
/* FYI: Some broken save handlers return FAILURE for non-existent session ID, this is incorrect */
- php_error_docref(NULL, E_WARNING, "Failed to read session data: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Failed to read session data: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ }
return FAILURE;
}
@@ -544,7 +553,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL, err_type, "Cannot find save handler '%s'", ZSTR_VAL(new_value));
+ php_error_docref(NULL, err_type, "Session save handler \"%s\" cannot be found", ZSTR_VAL(new_value));
}
return FAILURE;
@@ -552,7 +561,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
/* "user" save handler should not be set by user */
if (!PS(set_handler) && tmp == ps_user_ptr) {
- php_error_docref(NULL, E_RECOVERABLE_ERROR, "Cannot set 'user' save handler by ini_set() or session_module_name()");
+ php_error_docref(NULL, E_RECOVERABLE_ERROR, "Session save handler \"user\" cannot be set by ini_set() or session_module_name()");
return FAILURE;
}
@@ -583,7 +592,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL, err_type, "Cannot find serialization handler '%s'", ZSTR_VAL(new_value));
+ php_error_docref(NULL, err_type, "Serialization handler \"%s\" cannot be found", ZSTR_VAL(new_value));
}
return FAILURE;
}
@@ -660,7 +669,7 @@ static PHP_INI_MH(OnUpdateName) /* {{{ */
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
- php_error_docref(NULL, err_type, "session.name cannot be a numeric or empty '%s'", ZSTR_VAL(new_value));
+ php_error_docref(NULL, err_type, "session.name \"%s\" cannot be numeric or empty", ZSTR_VAL(new_value));
}
return FAILURE;
}
@@ -725,7 +734,7 @@ static PHP_INI_MH(OnUpdateSidLength) /* {{{ */
return SUCCESS;
}
- php_error_docref(NULL, E_WARNING, "session.configuration 'session.sid_length' must be between 22 and 256.");
+ php_error_docref(NULL, E_WARNING, "session.configuration \"session.sid_length\" must be between 22 and 256");
return FAILURE;
}
/* }}} */
@@ -745,7 +754,7 @@ static PHP_INI_MH(OnUpdateSidBits) /* {{{ */
return SUCCESS;
}
- php_error_docref(NULL, E_WARNING, "session.configuration 'session.sid_bits_per_character' must be between 4 and 6.");
+ php_error_docref(NULL, E_WARNING, "session.configuration \"session.sid_bits_per_character\" must be between 4 and 6");
return FAILURE;
}
/* }}} */
@@ -766,12 +775,12 @@ static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
int tmp;
tmp = zend_atoi(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
if(tmp < 0) {
- php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be greater than or equal to zero");
+ php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be greater than or equal to 0");
return FAILURE;
}
if(ZSTR_LEN(new_value) > 0 && ZSTR_VAL(new_value)[ZSTR_LEN(new_value)-1] == '%') {
if(tmp > 100) {
- php_error_docref(NULL, E_WARNING, "session.upload_progress.freq cannot be over 100%%");
+ php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be less than or equal to 100%%");
return FAILURE;
}
PS(rfc1867_freq) = -tmp;
@@ -1225,9 +1234,9 @@ static int php_session_cache_limiter(void) /* {{{ */
php_session_abort();
if (output_start_filename) {
- php_error_docref(NULL, E_WARNING, "Cannot send session cache limiter - headers already sent (output started at %s:%d)", output_start_filename, output_start_lineno);
+ php_error_docref(NULL, E_WARNING, "Session cache limiter cannot be sent after headers have already been sent (output started at %s:%d)", output_start_filename, output_start_lineno);
} else {
- php_error_docref(NULL, E_WARNING, "Cannot send session cache limiter - headers already sent");
+ php_error_docref(NULL, E_WARNING, "Session cache limiter cannot be sent after headers have already been sent");
}
return -2;
}
@@ -1303,9 +1312,9 @@ static int php_session_send_cookie(void) /* {{{ */
int output_start_lineno = php_output_get_start_lineno();
if (output_start_filename) {
- php_error_docref(NULL, E_WARNING, "Cannot send session cookie - headers already sent by (output started at %s:%d)", output_start_filename, output_start_lineno);
+ php_error_docref(NULL, E_WARNING, "Session cookie cannot be sent after headers have already been sent (output started at %s:%d)", output_start_filename, output_start_lineno);
} else {
- php_error_docref(NULL, E_WARNING, "Cannot send session cookie - headers already sent");
+ php_error_docref(NULL, E_WARNING, "Session cookie cannot be sent after headers have already been sent");
}
return FAILURE;
}
@@ -1497,7 +1506,7 @@ PHPAPI int php_session_start(void) /* {{{ */
switch (PS(session_status)) {
case php_session_active:
- php_error(E_NOTICE, "A session had already been started - ignoring session_start()");
+ php_error(E_NOTICE, "Ignoring session_start() because a session has already been started");
return FAILURE;
break;
@@ -1506,7 +1515,7 @@ PHPAPI int php_session_start(void) /* {{{ */
if (!PS(mod) && value) {
PS(mod) = _php_find_ps_module(value);
if (!PS(mod)) {
- php_error_docref(NULL, E_WARNING, "Cannot find save handler '%s' - session startup failed", value);
+ php_error_docref(NULL, E_WARNING, "Cannot find session save handler \"%s\" - session startup failed", value);
return FAILURE;
}
}
@@ -1514,7 +1523,7 @@ PHPAPI int php_session_start(void) /* {{{ */
if (!PS(serializer) && value) {
PS(serializer) = _php_find_ps_serializer(value);
if (!PS(serializer)) {
- php_error_docref(NULL, E_WARNING, "Cannot find serialization handler '%s' - session startup failed", value);
+ php_error_docref(NULL, E_WARNING, "Cannot find session serialization handler \"%s\" - session startup failed", value);
return FAILURE;
}
}
@@ -1687,12 +1696,12 @@ PHP_FUNCTION(session_set_cookie_params)
ZEND_PARSE_PARAMETERS_END();
if (PS(session_status) == php_session_active) {
- php_error_docref(NULL, E_WARNING, "Cannot change session cookie parameters when session is active");
+ php_error_docref(NULL, E_WARNING, "Session cookie parameters cannot be changed when a session is active");
RETURN_FALSE;
}
if (SG(headers_sent)) {
- php_error_docref(NULL, E_WARNING, "Cannot change session cookie parameters when headers already sent");
+ php_error_docref(NULL, E_WARNING, "Session cookie parameters cannot be changed after headers have already been sent");
RETURN_FALSE;
}
@@ -1733,16 +1742,16 @@ PHP_FUNCTION(session_set_cookie_params)
samesite = zval_get_string(value);
found++;
} else {
- php_error_docref(NULL, E_WARNING, "Unrecognized key '%s' found in the options array", ZSTR_VAL(key));
+ php_error_docref(NULL, E_WARNING, "Argument #1 ($lifetime_or_options) contains an unrecognized key \"%s\"", ZSTR_VAL(key));
}
} else {
- php_error_docref(NULL, E_WARNING, "Numeric key found in the options array");
+ php_error_docref(NULL, E_WARNING, "Argument #1 ($lifetime_or_options) cannot contain numeric keys");
}
} ZEND_HASH_FOREACH_END();
if (found == 0) {
- php_error_docref(NULL, E_WARNING, "No valid keys were found in the options array");
- RETURN_FALSE;
+ zend_argument_value_error(1, "must contain at least 1 valid key");
+ RETURN_THROWS();
}
} else {
lifetime = zval_get_string(lifetime_or_options);
@@ -1849,12 +1858,12 @@ PHP_FUNCTION(session_name)
}
if (name && PS(session_status) == php_session_active) {
- php_error_docref(NULL, E_WARNING, "Cannot change session name when session is active");
+ php_error_docref(NULL, E_WARNING, "Session name cannot be changed when a session is active");
RETURN_FALSE;
}
if (name && SG(headers_sent)) {
- php_error_docref(NULL, E_WARNING, "Cannot change session name when headers already sent");
+ php_error_docref(NULL, E_WARNING, "Session name cannot be changed after headers have already been sent");
RETURN_FALSE;
}
@@ -1879,12 +1888,12 @@ PHP_FUNCTION(session_module_name)
}
if (name && PS(session_status) == php_session_active) {
- php_error_docref(NULL, E_WARNING, "Cannot change save handler module when session is active");
+ php_error_docref(NULL, E_WARNING, "Session save handler module cannot be changed when a session is active");
RETURN_FALSE;
}
if (name && SG(headers_sent)) {
- php_error_docref(NULL, E_WARNING, "Cannot change save handler module when headers already sent");
+ php_error_docref(NULL, E_WARNING, "Session save handler module cannot be changed after headers have already been sent");
RETURN_FALSE;
}
@@ -1897,7 +1906,7 @@ PHP_FUNCTION(session_module_name)
if (name) {
if (!_php_find_ps_module(ZSTR_VAL(name))) {
- php_error_docref(NULL, E_WARNING, "Cannot find named PHP session module (%s)", ZSTR_VAL(name));
+ php_error_docref(NULL, E_WARNING, "Session handler module \"%s\" cannot be found", ZSTR_VAL(name));
zval_ptr_dtor_str(return_value);
RETURN_FALSE;
@@ -1916,12 +1925,12 @@ PHP_FUNCTION(session_module_name)
static int save_handler_check_session() {
if (PS(session_status) == php_session_active) {
- php_error_docref(NULL, E_WARNING, "Cannot change save handler when session is active");
+ php_error_docref(NULL, E_WARNING, "Session save handler cannot be changed when a session is active");
return FAILURE;
}
if (SG(headers_sent)) {
- php_error_docref(NULL, E_WARNING, "Cannot change save handler when headers already sent");
+ php_error_docref(NULL, E_WARNING, "Session save handler cannot be changed after headers have already been sent");
return FAILURE;
}
@@ -1963,7 +1972,7 @@ PHP_FUNCTION(session_set_save_handler)
add_next_index_zval(&PS(mod_user_names).names[i], obj);
add_next_index_str(&PS(mod_user_names).names[i], zend_string_copy(func_name));
} else {
- php_error_docref(NULL, E_ERROR, "Session handler's function table is corrupt");
+ php_error_docref(NULL, E_ERROR, "Session save handler function table is corrupt");
RETURN_FALSE;
}
@@ -2051,23 +2060,23 @@ PHP_FUNCTION(session_set_save_handler)
RETURN_THROWS();
}
- if (save_handler_check_session() == FAILURE) {
- RETURN_FALSE;
- }
-
- /* remove shutdown function */
- remove_user_shutdown_function("session_shutdown", sizeof("session_shutdown") - 1);
-
/* At this point argc can only be between 6 and PS_NUM_APIS */
for (i = 0; i < argc; i++) {
if (!zend_is_callable(&args[i], 0, NULL)) {
zend_string *name = zend_get_callable_name(&args[i]);
- php_error_docref(NULL, E_WARNING, "Argument %d is not a valid callback", i+1);
- zend_string_release_ex(name, 0);
- RETURN_FALSE;
+ zend_argument_type_error(i + 1, "must be a valid callback, function \"%s\" not found or invalid function name", ZSTR_VAL(name));
+ zend_string_release(name);
+ RETURN_THROWS();
}
}
+ if (save_handler_check_session() == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ /* remove shutdown function */
+ remove_user_shutdown_function("session_shutdown", sizeof("session_shutdown") - 1);
+
if (PS(mod) && PS(mod) != &ps_mod_user) {
ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0);
ini_val = zend_string_init("user", sizeof("user") - 1, 0);
@@ -2100,12 +2109,12 @@ PHP_FUNCTION(session_save_path)
}
if (name && PS(session_status) == php_session_active) {
- php_error_docref(NULL, E_WARNING, "Cannot change save path when session is active");
+ php_error_docref(NULL, E_WARNING, "Session save path cannot be changed when a session is active");
RETURN_FALSE;
}
if (name && SG(headers_sent)) {
- php_error_docref(NULL, E_WARNING, "Cannot change save path when headers already sent");
+ php_error_docref(NULL, E_WARNING, "Session save path cannot be changed after headers have already been sent");
RETURN_FALSE;
}
@@ -2129,13 +2138,13 @@ PHP_FUNCTION(session_id)
RETURN_THROWS();
}
- if (name && PS(use_cookies) && SG(headers_sent)) {
- php_error_docref(NULL, E_WARNING, "Cannot change session id when headers already sent");
+ if (name && PS(session_status) == php_session_active) {
+ php_error_docref(NULL, E_WARNING, "Session ID cannot be changed when a session is active");
RETURN_FALSE;
}
- if (name && PS(session_status) == php_session_active) {
- php_error_docref(NULL, E_WARNING, "Cannot change session id when session is active");
+ if (name && PS(use_cookies) && SG(headers_sent)) {
+ php_error_docref(NULL, E_WARNING, "Session ID cannot be changed after headers have already been sent");
RETURN_FALSE;
}
@@ -2172,12 +2181,12 @@ PHP_FUNCTION(session_regenerate_id)
}
if (PS(session_status) != php_session_active) {
- php_error_docref(NULL, E_WARNING, "Cannot regenerate session id - session is not active");
+ php_error_docref(NULL, E_WARNING, "Session ID cannot be regenerated when there is no active session");
RETURN_FALSE;
}
if (SG(headers_sent)) {
- php_error_docref(NULL, E_WARNING, "Cannot regenerate session id - headers already sent");
+ php_error_docref(NULL, E_WARNING, "Session ID cannot be regenerated after headers have already been sent");
RETURN_FALSE;
}
@@ -2186,7 +2195,9 @@ PHP_FUNCTION(session_regenerate_id)
if (PS(mod)->s_destroy(&PS(mod_data), PS(id)) == FAILURE) {
PS(mod)->s_close(&PS(mod_data));
PS(session_status) = php_session_none;
- php_error_docref(NULL, E_WARNING, "Session object destruction failed. ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Session object destruction failed. ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ }
RETURN_FALSE;
}
} else {
@@ -2217,14 +2228,18 @@ PHP_FUNCTION(session_regenerate_id)
if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) {
PS(session_status) = php_session_none;
- zend_throw_error(NULL, "Failed to open session: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ if (!EG(exception)) {
+ zend_throw_error(NULL, "Failed to open session: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ }
RETURN_THROWS();
}
PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
if (!PS(id)) {
PS(session_status) = php_session_none;
- zend_throw_error(NULL, "Failed to create new session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ if (!EG(exception)) {
+ zend_throw_error(NULL, "Failed to create new session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ }
RETURN_THROWS();
}
if (PS(use_strict_mode) && PS(mod)->s_validate_sid &&
@@ -2234,7 +2249,9 @@ PHP_FUNCTION(session_regenerate_id)
if (!PS(id)) {
PS(mod)->s_close(&PS(mod_data));
PS(session_status) = php_session_none;
- zend_throw_error(NULL, "Failed to create session ID by collision: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ if (!EG(exception)) {
+ zend_throw_error(NULL, "Failed to create session ID by collision: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ }
RETURN_THROWS();
}
}
@@ -2242,7 +2259,9 @@ PHP_FUNCTION(session_regenerate_id)
if (PS(mod)->s_read(&PS(mod_data), PS(id), &data, PS(gc_maxlifetime)) == FAILURE) {
PS(mod)->s_close(&PS(mod_data));
PS(session_status) = php_session_none;
- zend_throw_error(NULL, "Failed to create(read) session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ if (!EG(exception)) {
+ zend_throw_error(NULL, "Failed to create(read) session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ }
RETURN_THROWS();
}
if (data) {
@@ -2274,7 +2293,7 @@ PHP_FUNCTION(session_create_id)
if (prefix && ZSTR_LEN(prefix)) {
if (php_session_valid_key(ZSTR_VAL(prefix)) == FAILURE) {
/* E_ERROR raised for security reason. */
- php_error_docref(NULL, E_WARNING, "Prefix cannot contain special characters. Only aphanumeric, ',', '-' are allowed");
+ php_error_docref(NULL, E_WARNING, "Prefix cannot contain special characters. Only the A-Z, a-z, 0-9, \"-\", and \",\" characters are allowed");
RETURN_FALSE;
} else {
smart_str_append(&id, prefix);
@@ -2325,12 +2344,12 @@ PHP_FUNCTION(session_cache_limiter)
}
if (limiter && PS(session_status) == php_session_active) {
- php_error_docref(NULL, E_WARNING, "Cannot change cache limiter when session is active");
+ php_error_docref(NULL, E_WARNING, "Session cache limiter cannot be changed when a session is active");
RETURN_FALSE;
}
if (limiter && SG(headers_sent)) {
- php_error_docref(NULL, E_WARNING, "Cannot change cache limiter when headers already sent");
+ php_error_docref(NULL, E_WARNING, "Session cache limiter cannot be changed after headers have already been sent");
RETURN_FALSE;
}
@@ -2355,12 +2374,12 @@ PHP_FUNCTION(session_cache_expire)
}
if (!expires_is_null && PS(session_status) == php_session_active) {
- php_error_docref(NULL, E_WARNING, "Cannot change cache expire when session is active");
+ php_error_docref(NULL, E_WARNING, "Session cache expiration cannot be changed when a session is active");
RETURN_LONG(PS(cache_expire));
}
if (!expires_is_null && SG(headers_sent)) {
- php_error_docref(NULL, E_WARNING, "Cannot change cache expire when headers already sent");
+ php_error_docref(NULL, E_WARNING, "Session cache expiration cannot be changed after headers have already been sent");
RETURN_FALSE;
}
@@ -2404,7 +2423,7 @@ PHP_FUNCTION(session_decode)
}
if (PS(session_status) != php_session_active) {
- php_error_docref(NULL, E_WARNING, "Session is not active. You cannot decode session data");
+ php_error_docref(NULL, E_WARNING, "Session data cannot be decoded when there is no active session");
RETURN_FALSE;
}
@@ -2427,7 +2446,7 @@ static int php_session_start_set_ini(zend_string *varname, zend_string *new_valu
return ret;
}
-/* {{{ + Begin session */
+/* {{{ Begin session */
PHP_FUNCTION(session_start)
{
zval *options = NULL;
@@ -2441,7 +2460,7 @@ PHP_FUNCTION(session_start)
}
if (PS(session_status) == php_session_active) {
- php_error_docref(NULL, E_NOTICE, "A session had already been started - ignoring");
+ php_error_docref(NULL, E_NOTICE, "Ignoring session_start() because a session is already active");
RETURN_TRUE;
}
@@ -2451,7 +2470,7 @@ PHP_FUNCTION(session_start)
* module is unable to rewrite output.
*/
if (PS(use_cookies) && SG(headers_sent)) {
- php_error_docref(NULL, E_WARNING, "Cannot start session when headers already sent");
+ php_error_docref(NULL, E_WARNING, "Session cannot be started after headers have already been sent");
RETURN_FALSE;
}
@@ -2470,14 +2489,16 @@ PHP_FUNCTION(session_start)
zend_string *tmp_val;
zend_string *val = zval_get_tmp_string(value, &tmp_val);
if (php_session_start_set_ini(str_idx, val) == FAILURE) {
- php_error_docref(NULL, E_WARNING, "Setting option '%s' failed", ZSTR_VAL(str_idx));
+ php_error_docref(NULL, E_WARNING, "Setting option \"%s\" failed", ZSTR_VAL(str_idx));
}
zend_tmp_string_release(tmp_val);
}
break;
default:
- php_error_docref(NULL, E_WARNING, "Option(%s) value must be string, boolean or long", ZSTR_VAL(str_idx));
- break;
+ zend_type_error("%s(): Option \"%s\" must be of type string|int|bool, %s given",
+ get_active_function_name(), ZSTR_VAL(str_idx), zend_zval_type_name(value)
+ );
+ RETURN_THROWS();
}
}
(void) num_idx;
@@ -2547,7 +2568,7 @@ PHP_FUNCTION(session_gc)
}
if (PS(session_status) != php_session_active) {
- php_error_docref(NULL, E_WARNING, "Session is not active");
+ php_error_docref(NULL, E_WARNING, "Session cannot be garbage collected when there is no active session");
RETURN_FALSE;
}
@@ -2647,7 +2668,7 @@ PHP_FUNCTION(session_register_shutdown)
* session then tough luck.
*/
php_session_flush(1);
- php_error_docref(NULL, E_WARNING, "Unable to register session flush function");
+ php_error_docref(NULL, E_WARNING, "Session shutdown function cannot be registered");
}
}
/* }}} */
diff --git a/ext/session/session.stub.php b/ext/session/session.stub.php
index e70669d5a8819..b8f9f33eba628 100644
--- a/ext/session/session.stub.php
+++ b/ext/session/session.stub.php
@@ -42,15 +42,8 @@ function session_commit(): bool {}
/**
* @param callable|object $open
* @param callable|bool $close
- * @param callable $read
- * @param callable $write
- * @param callable $destroy
- * @param callable $gc
- * @param callable $create_sid
- * @param callable $validate_sid
- * @param callable $update_timestamp
*/
-function session_set_save_handler($open, $close = UNKNOWN, $read = UNKNOWN, $write = UNKNOWN, $destroy = UNKNOWN, $gc = UNKNOWN, $create_sid = UNKNOWN, $validate_sid = UNKNOWN, $update_timestamp = UNKNOWN): bool {}
+function session_set_save_handler($open, $close = UNKNOWN, callable $read = UNKNOWN, callable $write = UNKNOWN, callable $destroy = UNKNOWN, callable $gc = UNKNOWN, callable $create_sid = UNKNOWN, callable $validate_sid = UNKNOWN, callable $update_timestamp = UNKNOWN): bool {}
function session_cache_limiter(?string $cache_limiter = null): string|false {}
diff --git a/ext/session/session_arginfo.h b/ext/session/session_arginfo.h
index 622eb4cfb52a3..c47dee63154fe 100644
--- a/ext/session/session_arginfo.h
+++ b/ext/session/session_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 9e4a4b1d719197772b283abfb1e515180d7b8bb0 */
+ * Stub hash: 22b829d3cdd092c393c924f323cd19bea1517579 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_name, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, name, IS_STRING, 1, "null")
@@ -60,13 +60,13 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_set_save_handler, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, open)
ZEND_ARG_INFO(0, close)
- ZEND_ARG_INFO(0, read)
- ZEND_ARG_INFO(0, write)
- ZEND_ARG_INFO(0, destroy)
- ZEND_ARG_INFO(0, gc)
- ZEND_ARG_INFO(0, create_sid)
- ZEND_ARG_INFO(0, validate_sid)
- ZEND_ARG_INFO(0, update_timestamp)
+ ZEND_ARG_TYPE_INFO(0, read, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, write, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, destroy, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, gc, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, create_sid, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, validate_sid, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, update_timestamp, IS_CALLABLE, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_cache_limiter, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
diff --git a/ext/session/tests/014.phpt b/ext/session/tests/014.phpt
index cbf22b142d614..d8369cfec5983 100644
--- a/ext/session/tests/014.phpt
+++ b/ext/session/tests/014.phpt
@@ -33,8 +33,8 @@ session_destroy();
--EXPECTF--
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line %d
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line %d
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
diff --git a/ext/session/tests/016.phpt b/ext/session/tests/016.phpt
index aa7ba1cebb979..8a076a1d9f434 100644
--- a/ext/session/tests/016.phpt
+++ b/ext/session/tests/016.phpt
@@ -22,7 +22,7 @@ session_write_close();
print "I live\n";
?>
--EXPECTF--
-Warning: session_start(): Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d) in %s on line 4
+Warning: session_start(): Failed to create session data file path. Too short session ID, invalid save_path or path length exceeds %d characters in %s on line %d
Warning: session_start(): Failed to read session data: files (path: 123;:/really%scompletely:::/invalid;;,23123;213) in %s on line 4
I live
diff --git a/ext/session/tests/029.phpt b/ext/session/tests/029.phpt
index 23676ecbda61d..518ead85d66e1 100644
--- a/ext/session/tests/029.phpt
+++ b/ext/session/tests/029.phpt
@@ -14,7 +14,7 @@ session_decode("userid|s:5:\"mazen\";chatRoom|s:1:\"1\";");
print "I live\n";
?>
--EXPECTF--
-Warning: session_decode(): Session is not active. You cannot decode session data in %s on line %d
+Warning: session_decode(): Session data cannot be decoded when there is no active session in %s on line %d
-Warning: session_decode(): Session is not active. You cannot decode session data in %s on line %d
+Warning: session_decode(): Session data cannot be decoded when there is no active session in %s on line %d
I live
diff --git a/ext/session/tests/bug31454.phpt b/ext/session/tests/bug31454.phpt
index 9e99135e5fda3..4ae0dbd7f560c 100644
--- a/ext/session/tests/bug31454.phpt
+++ b/ext/session/tests/bug31454.phpt
@@ -5,16 +5,21 @@ Bug #31454 (session_set_save_handler crashes PHP when supplied non-existent obje
--FILE--
getMessage() . "\n";
+}
echo "Done\n";
?>
---EXPECTF--
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %sbug31454.php on line %d
+--EXPECT--
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "Array" not found or invalid function name
Done
diff --git a/ext/session/tests/bug60860.phpt b/ext/session/tests/bug60860.phpt
index e2b961c387e07..487fba53074c6 100644
--- a/ext/session/tests/bug60860.phpt
+++ b/ext/session/tests/bug60860.phpt
@@ -15,5 +15,5 @@ echo "ok\n";
?>
--EXPECT--
-Recoverable fatal error: PHP Startup: Cannot set 'user' save handler by ini_set() or session_module_name() in Unknown on line 0
+Recoverable fatal error: PHP Startup: Session save handler "user" cannot be set by ini_set() or session_module_name() in Unknown on line 0
ok
diff --git a/ext/session/tests/bug66481.phpt b/ext/session/tests/bug66481.phpt
index 626b4977592da..ba0f2d28b10f5 100644
--- a/ext/session/tests/bug66481.phpt
+++ b/ext/session/tests/bug66481.phpt
@@ -13,6 +13,6 @@ var_dump(session_name("foo"));
var_dump(session_name("bar"));
?>
--EXPECT--
-Warning: PHP Startup: session.name cannot be a numeric or empty '' in Unknown on line 0
+Warning: PHP Startup: session.name "" cannot be numeric or empty in Unknown on line 0
string(9) "PHPSESSID"
string(3) "foo"
diff --git a/ext/session/tests/bug73100.phpt b/ext/session/tests/bug73100.phpt
index 9334bbf16e372..a59e9f41cc123 100644
--- a/ext/session/tests/bug73100.phpt
+++ b/ext/session/tests/bug73100.phpt
@@ -20,7 +20,7 @@ session_module_name("user");
--EXPECTF--
bool(true)
-Warning: session_module_name(): Cannot change save handler module when session is active in %s on line 4
+Warning: session_module_name(): Session save handler module cannot be changed when a session is active in %s on line %d
bool(true)
-Recoverable fatal error: session_module_name(): Cannot set 'user' save handler by ini_set() or session_module_name() in %s on line 7
+Recoverable fatal error: session_module_name(): Session save handler "user" cannot be set by ini_set() or session_module_name() in %s on line %d
diff --git a/ext/session/tests/rfc1867_invalid_settings.phpt b/ext/session/tests/rfc1867_invalid_settings.phpt
index fcdb40d3ba247..bfec37c9cd117 100644
--- a/ext/session/tests/rfc1867_invalid_settings.phpt
+++ b/ext/session/tests/rfc1867_invalid_settings.phpt
@@ -12,5 +12,5 @@ include('skipif.inc');
var_dump(ini_get("session.upload_progress.freq"));
?>
--EXPECTF--
-Warning: PHP Startup: session.upload_progress.freq must be greater than or equal to zero in %s
+Warning: PHP Startup: session.upload_progress.freq must be greater than or equal to 0 in Unknown on line 0
string(%d) "1%"
diff --git a/ext/session/tests/rfc1867_invalid_settings_2.phpt b/ext/session/tests/rfc1867_invalid_settings_2.phpt
index cafe0070761c2..bf8e6cc2dd0cc 100644
--- a/ext/session/tests/rfc1867_invalid_settings_2.phpt
+++ b/ext/session/tests/rfc1867_invalid_settings_2.phpt
@@ -12,5 +12,5 @@ include('skipif.inc');
var_dump(ini_get("session.upload_progress.freq"));
?>
--EXPECTF--
-Warning: PHP Startup: session.upload_progress.freq cannot be over 100% in %s
+Warning: PHP Startup: session.upload_progress.freq must be less than or equal to 100% in Unknown on line 0
string(%d) "1%"
diff --git a/ext/session/tests/rfc1867_sid_invalid.phpt b/ext/session/tests/rfc1867_sid_invalid.phpt
index b75a9f64708d3..4d8372c538149 100644
--- a/ext/session/tests/rfc1867_sid_invalid.phpt
+++ b/ext/session/tests/rfc1867_sid_invalid.phpt
@@ -45,14 +45,18 @@ var_dump($_FILES);
var_dump($_SESSION["upload_progress_" . basename(__FILE__)]);
session_destroy();
?>
+--CLEAN--
+
--EXPECTF--
-Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
+Warning: Unknown: Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, "-", and "," characters are allowed in Unknown on line 0
Warning: Unknown: Failed to read session data: files (path: ) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0
-Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
+Warning: Unknown: Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, "-", and "," characters are allowed in Unknown on line 0
Warning: Unknown: Failed to read session data: files (path: ) in Unknown on line 0
diff --git a/ext/session/tests/session_cache_limiter_variation1.phpt b/ext/session/tests/session_cache_limiter_variation1.phpt
index 1ef15d7ff5d4b..3241cb3cdb73a 100644
--- a/ext/session/tests/session_cache_limiter_variation1.phpt
+++ b/ext/session/tests/session_cache_limiter_variation1.phpt
@@ -28,7 +28,7 @@ string(7) "nocache"
bool(true)
string(7) "nocache"
-Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line %d
+Warning: session_cache_limiter(): Session cache limiter cannot be changed when a session is active in %s on line %d
bool(false)
string(7) "nocache"
bool(true)
diff --git a/ext/session/tests/session_cache_limiter_variation2.phpt b/ext/session/tests/session_cache_limiter_variation2.phpt
index 695f63ebca8e8..00724a3f9a707 100644
--- a/ext/session/tests/session_cache_limiter_variation2.phpt
+++ b/ext/session/tests/session_cache_limiter_variation2.phpt
@@ -27,7 +27,7 @@ string(7) "nocache"
bool(true)
string(7) "nocache"
-Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line %d
+Warning: session_cache_limiter(): Session cache limiter cannot be changed when a session is active in %s on line %d
bool(false)
string(7) "nocache"
bool(true)
diff --git a/ext/session/tests/session_cache_limiter_variation3.phpt b/ext/session/tests/session_cache_limiter_variation3.phpt
index f37af43936f61..8f4e9296d1c7c 100644
--- a/ext/session/tests/session_cache_limiter_variation3.phpt
+++ b/ext/session/tests/session_cache_limiter_variation3.phpt
@@ -26,7 +26,7 @@ string(7) "nocache"
bool(true)
string(7) "nocache"
-Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line %d
+Warning: session_cache_limiter(): Session cache limiter cannot be changed when a session is active in %s on line %d
bool(false)
string(7) "nocache"
bool(true)
diff --git a/ext/session/tests/session_decode_variation3.phpt b/ext/session/tests/session_decode_variation3.phpt
index 9494edd3394b1..ef4eab2bd23d1 100644
--- a/ext/session/tests/session_decode_variation3.phpt
+++ b/ext/session/tests/session_decode_variation3.phpt
@@ -28,7 +28,7 @@ ob_end_flush();
--EXPECTF--
*** Testing session_decode() : variation ***
-Warning: session_start(): Cannot find serialization handler 'blah' - session startup failed in %s on line %d
+Warning: session_start(): Cannot find session serialization handler "blah" - session startup failed in %s on line %d
bool(false)
Warning: Undefined variable $_SESSION in %s on line %d
@@ -42,7 +42,7 @@ array(3) {
float(123.456)
}
-Warning: session_decode(): Session is not active. You cannot decode session data in %s on line %d
+Warning: session_decode(): Session data cannot be decoded when there is no active session in %s on line %d
bool(false)
array(3) {
["foo"]=>
diff --git a/ext/session/tests/session_encode_error2.phpt b/ext/session/tests/session_encode_error2.phpt
index 9cca3ffea4737..a2d3d0ca309a6 100644
--- a/ext/session/tests/session_encode_error2.phpt
+++ b/ext/session/tests/session_encode_error2.phpt
@@ -98,63 +98,63 @@ ob_end_flush();
-- Iteration 1 --
bool(true)
-Notice: session_encode(): Skipping numeric key 0 in %s on line %d
+Warning: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
-- Iteration 2 --
bool(true)
-Notice: session_encode(): Skipping numeric key 1 in %s on line %d
+Warning: session_encode(): Skipping numeric key 1 in %s on line %d
bool(false)
bool(true)
-- Iteration 3 --
bool(true)
-Notice: session_encode(): Skipping numeric key 12345 in %s on line %d
+Warning: session_encode(): Skipping numeric key 12345 in %s on line %d
bool(false)
bool(true)
-- Iteration 4 --
bool(true)
-Notice: session_encode(): Skipping numeric key -2345 in %s on line %d
+Warning: session_encode(): Skipping numeric key -2345 in %s on line %d
bool(false)
bool(true)
-- Iteration 5 --
bool(true)
-Notice: session_encode(): Skipping numeric key 10 in %s on line %d
+Warning: session_encode(): Skipping numeric key 10 in %s on line %d
bool(false)
bool(true)
-- Iteration 6 --
bool(true)
-Notice: session_encode(): Skipping numeric key -10 in %s on line %d
+Warning: session_encode(): Skipping numeric key -10 in %s on line %d
bool(false)
bool(true)
-- Iteration 7 --
bool(true)
-Notice: session_encode(): Skipping numeric key %s in %s on line %d
+Warning: session_encode(): Skipping numeric key %s in %s on line %d
bool(false)
bool(true)
-- Iteration 8 --
bool(true)
-Notice: session_encode(): Skipping numeric key 0 in %s on line %d
+Warning: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
-- Iteration 9 --
bool(true)
-Notice: session_encode(): Skipping numeric key 0 in %s on line %d
+Warning: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
@@ -171,28 +171,28 @@ bool(true)
-- Iteration 12 --
bool(true)
-Notice: session_encode(): Skipping numeric key 1 in %s on line %d
+Warning: session_encode(): Skipping numeric key 1 in %s on line %d
bool(false)
bool(true)
-- Iteration 13 --
bool(true)
-Notice: session_encode(): Skipping numeric key 0 in %s on line %d
+Warning: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
-- Iteration 14 --
bool(true)
-Notice: session_encode(): Skipping numeric key 1 in %s on line %d
+Warning: session_encode(): Skipping numeric key 1 in %s on line %d
bool(false)
bool(true)
-- Iteration 15 --
bool(true)
-Notice: session_encode(): Skipping numeric key 0 in %s on line %d
+Warning: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
@@ -242,7 +242,7 @@ bool(true)
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-Notice: session_encode(): Skipping numeric key %d in %s on line %d
+Warning: session_encode(): Skipping numeric key %d in %s on line %d
bool(false)
bool(true)
Done
diff --git a/ext/session/tests/session_encode_variation6.phpt b/ext/session/tests/session_encode_variation6.phpt
index b334842feada3..5305d483b5b02 100644
--- a/ext/session/tests/session_encode_variation6.phpt
+++ b/ext/session/tests/session_encode_variation6.phpt
@@ -29,17 +29,17 @@ ob_end_flush();
*** Testing session_encode() : variation ***
bool(true)
-Notice: session_encode(): Skipping numeric key 0 in %s on line %d
+Warning: session_encode(): Skipping numeric key 0 in %s on line %d
bool(false)
bool(true)
bool(true)
-Notice: session_encode(): Skipping numeric key 1234567890 in %s on line %d
+Warning: session_encode(): Skipping numeric key 1234567890 in %s on line %d
bool(false)
bool(true)
bool(true)
-Notice: session_encode(): Skipping numeric key -1234567890 in %s on line %d
+Warning: session_encode(): Skipping numeric key -1234567890 in %s on line %d
bool(false)
bool(true)
Done
diff --git a/ext/session/tests/session_encode_variation8.phpt b/ext/session/tests/session_encode_variation8.phpt
index 2ffa79335be1a..8b867b6b636e5 100644
--- a/ext/session/tests/session_encode_variation8.phpt
+++ b/ext/session/tests/session_encode_variation8.phpt
@@ -23,7 +23,7 @@ ob_end_flush();
--EXPECTF--
*** Testing session_encode() : variation ***
-Warning: session_start(): Cannot find serialization handler 'blah' - session startup failed in %s on line %d
+Warning: session_start(): Cannot find session serialization handler "blah" - session startup failed in %s on line %d
bool(false)
Warning: session_encode(): Cannot encode non-existent session in %s on line %d
diff --git a/ext/session/tests/session_gc_basic.phpt b/ext/session/tests/session_gc_basic.phpt
index b98c7e43e1a48..103b784c8f423 100644
--- a/ext/session/tests/session_gc_basic.phpt
+++ b/ext/session/tests/session_gc_basic.phpt
@@ -22,7 +22,7 @@ ob_end_flush();
--EXPECTF--
*** Testing session_gc() : basic functionality ***
-Warning: session_gc(): Session is not active in %s on line %d
+Warning: session_gc(): Session cannot be garbage collected when there is no active session in %s on line %d
bool(false)
bool(true)
int(%d)
diff --git a/ext/session/tests/session_id_error2.phpt b/ext/session/tests/session_id_error2.phpt
index c017d73d6bba3..23a9a59a2bcca 100644
--- a/ext/session/tests/session_id_error2.phpt
+++ b/ext/session/tests/session_id_error2.phpt
@@ -29,7 +29,7 @@ string(4) "test"
string(10) "1234567890"
bool(true)
-Warning: session_id(): Cannot change session id when session is active in %s on line %d
+Warning: session_id(): Session ID cannot be changed when a session is active in %s on line %d
bool(false)
bool(true)
string(0) ""
diff --git a/ext/session/tests/session_ini_set.phpt b/ext/session/tests/session_ini_set.phpt
index 58c3f837a7ea2..0335d5823986d 100644
--- a/ext/session/tests/session_ini_set.phpt
+++ b/ext/session/tests/session_ini_set.phpt
@@ -116,67 +116,67 @@ string(1) "4"
string(1) "1"
string(15) "session started"
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 38
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 39
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 40
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 42
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 43
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 44
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 45
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 46
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 47
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 48
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 49
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 50
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 51
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 52
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 53
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 54
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 55
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 56
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 57
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 58
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
-Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line 59
+Warning: ini_set(): Session ini settings cannot be changed when a session is active in %s on line %d
bool(false)
Done
diff --git a/ext/session/tests/session_module_name_variation1.phpt b/ext/session/tests/session_module_name_variation1.phpt
index 05c972fb91c36..fff325ad964d2 100644
--- a/ext/session/tests/session_module_name_variation1.phpt
+++ b/ext/session/tests/session_module_name_variation1.phpt
@@ -20,7 +20,7 @@ ob_end_flush();
--EXPECTF--
*** Testing session_module_name() : variation ***
-Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d
+Warning: session_module_name(): Session handler module "blah" cannot be found in %s on line %d
bool(false)
bool(true)
string(%d) "%s"
diff --git a/ext/session/tests/session_module_name_variation3.phpt b/ext/session/tests/session_module_name_variation3.phpt
index 481229eebca97..2be7b636de3d6 100644
--- a/ext/session/tests/session_module_name_variation3.phpt
+++ b/ext/session/tests/session_module_name_variation3.phpt
@@ -36,8 +36,6 @@ ob_end_flush();
string(5) "files"
string(4) "user"
-Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d
-
Fatal error: Uncaught Exception: Stop...! in %s:%d
Stack trace:
#0 [internal function]: open('', 'PHPSESSID')
diff --git a/ext/session/tests/session_name_variation1.phpt b/ext/session/tests/session_name_variation1.phpt
index 35db378ea5239..71849de565beb 100644
--- a/ext/session/tests/session_name_variation1.phpt
+++ b/ext/session/tests/session_name_variation1.phpt
@@ -47,7 +47,7 @@ string(1) " "
bool(true)
string(1) " "
-Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d
+Warning: session_name(): session.name "" cannot be numeric or empty in %s on line %d
string(1) " "
bool(true)
string(1) " "
diff --git a/ext/session/tests/session_regenerate_id_basic.phpt b/ext/session/tests/session_regenerate_id_basic.phpt
index 8d221ef006e65..9be5a65b1b0b0 100644
--- a/ext/session/tests/session_regenerate_id_basic.phpt
+++ b/ext/session/tests/session_regenerate_id_basic.phpt
@@ -26,7 +26,7 @@ ob_end_flush();
*** Testing session_regenerate_id() : basic functionality ***
string(0) ""
-Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
+Warning: session_regenerate_id(): Session ID cannot be regenerated when there is no active session in %s on line %d
bool(false)
string(0) ""
bool(true)
@@ -34,7 +34,7 @@ bool(true)
string(%d) "%s"
bool(true)
-Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
+Warning: session_regenerate_id(): Session ID cannot be regenerated when there is no active session in %s on line %d
bool(false)
string(0) ""
Done
diff --git a/ext/session/tests/session_regenerate_id_variation1.phpt b/ext/session/tests/session_regenerate_id_variation1.phpt
index 1967cff01843c..806f20696eb39 100644
--- a/ext/session/tests/session_regenerate_id_variation1.phpt
+++ b/ext/session/tests/session_regenerate_id_variation1.phpt
@@ -26,7 +26,7 @@ ob_end_flush();
*** Testing session_regenerate_id() : variation ***
string(0) ""
-Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
+Warning: session_regenerate_id(): Session ID cannot be regenerated when there is no active session in %s on line %d
bool(false)
string(0) ""
bool(true)
@@ -34,7 +34,7 @@ bool(true)
string(%d) "%s"
bool(true)
-Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
+Warning: session_regenerate_id(): Session ID cannot be regenerated when there is no active session in %s on line %d
bool(false)
string(0) ""
Done
diff --git a/ext/session/tests/session_save_path_variation1.phpt b/ext/session/tests/session_save_path_variation1.phpt
index 8475b2d2e4a50..8dbddca98da27 100644
--- a/ext/session/tests/session_save_path_variation1.phpt
+++ b/ext/session/tests/session_save_path_variation1.phpt
@@ -38,7 +38,7 @@ string(%d) "%stests"
bool(true)
string(%d) "%stests"
-Warning: session_save_path(): Cannot change save path when session is active in %s on line %d
+Warning: session_save_path(): Session save path cannot be changed when a session is active in %s on line %d
bool(false)
string(%d) "%stests"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_basic.phpt b/ext/session/tests/session_set_cookie_params_basic.phpt
index 79bf7a9ea9467..21f04ef17ff6f 100644
--- a/ext/session/tests/session_set_cookie_params_basic.phpt
+++ b/ext/session/tests/session_set_cookie_params_basic.phpt
@@ -23,7 +23,7 @@ ob_end_flush();
bool(true)
bool(true)
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
+Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d
bool(false)
bool(true)
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation1.phpt b/ext/session/tests/session_set_cookie_params_variation1.phpt
index bad85d3aaf0fa..7b2c474d1a60a 100644
--- a/ext/session/tests/session_set_cookie_params_variation1.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation1.phpt
@@ -36,7 +36,7 @@ string(4) "3600"
bool(true)
string(4) "3600"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
+Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d
bool(false)
string(4) "3600"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation2.phpt b/ext/session/tests/session_set_cookie_params_variation2.phpt
index ac80c10c10bf1..ca3f0aa887777 100644
--- a/ext/session/tests/session_set_cookie_params_variation2.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation2.phpt
@@ -34,7 +34,7 @@ string(4) "/foo"
bool(true)
string(4) "/foo"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
+Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d
bool(false)
string(4) "/foo"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation3.phpt b/ext/session/tests/session_set_cookie_params_variation3.phpt
index 1ba46eae7d7ac..166730f89a538 100644
--- a/ext/session/tests/session_set_cookie_params_variation3.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation3.phpt
@@ -34,7 +34,7 @@ string(4) "blah"
bool(true)
string(4) "blah"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
+Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d
bool(false)
string(4) "blah"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation4.phpt b/ext/session/tests/session_set_cookie_params_variation4.phpt
index 16606f9f611b5..380defcd2ccb3 100644
--- a/ext/session/tests/session_set_cookie_params_variation4.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation4.phpt
@@ -34,7 +34,7 @@ string(1) "0"
bool(true)
string(1) "0"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
+Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d
bool(false)
string(1) "0"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation5.phpt b/ext/session/tests/session_set_cookie_params_variation5.phpt
index a73c834ed7559..390937258be1e 100644
--- a/ext/session/tests/session_set_cookie_params_variation5.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation5.phpt
@@ -34,7 +34,7 @@ string(1) "0"
bool(true)
string(1) "0"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
+Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d
bool(false)
string(1) "0"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation6.phpt b/ext/session/tests/session_set_cookie_params_variation6.phpt
index 983e8e68adabf..9d9f116d422af 100644
--- a/ext/session/tests/session_set_cookie_params_variation6.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation6.phpt
@@ -34,7 +34,7 @@ string(7) "nothing"
bool(true)
string(7) "nothing"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
+Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in %s on line %d
bool(false)
string(7) "nothing"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation7.phpt b/ext/session/tests/session_set_cookie_params_variation7.phpt
index bd5aec592bb72..25feabf1fd29c 100644
--- a/ext/session/tests/session_set_cookie_params_variation7.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation7.phpt
@@ -17,8 +17,17 @@ ob_start();
echo "*** Testing session_set_cookie_params() : array parameter variation ***\n";
// Invalid cases
-var_dump(session_set_cookie_params([]));
-var_dump(session_set_cookie_params(["unknown_key" => true, "secure_invalid" => true]));
+try {
+ session_set_cookie_params([]);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ session_set_cookie_params(["unknown_key" => true, "secure_invalid" => true]);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
var_dump(ini_get("session.cookie_secure"));
var_dump(ini_get("session.cookie_samesite"));
@@ -39,16 +48,12 @@ ob_end_flush();
?>
--EXPECTF--
*** Testing session_set_cookie_params() : array parameter variation ***
+session_set_cookie_params(): Argument #1 ($lifetime_or_options) must contain at least 1 valid key
-Warning: session_set_cookie_params(): No valid keys were found in the options array in %s
-bool(false)
-
-Warning: session_set_cookie_params(): Unrecognized key 'unknown_key' found in the options array in %s
+Warning: session_set_cookie_params(): Argument #1 ($lifetime_or_options) contains an unrecognized key "unknown_key" in %s on line %d
-Warning: session_set_cookie_params(): Unrecognized key 'secure_invalid' found in the options array in %s
-
-Warning: session_set_cookie_params(): No valid keys were found in the options array in %s
-bool(false)
+Warning: session_set_cookie_params(): Argument #1 ($lifetime_or_options) contains an unrecognized key "secure_invalid" in %s on line %d
+session_set_cookie_params(): Argument #1 ($lifetime_or_options) must contain at least 1 valid key
string(1) "0"
string(0) ""
bool(true)
@@ -59,7 +64,7 @@ bool(true)
string(2) "42"
string(1) "/"
-Warning: session_set_cookie_params(): Cannot pass arguments after the options array in %s
+Warning: session_set_cookie_params(): Cannot pass arguments after the options array in %s on line %d
bool(false)
string(1) "/"
Done
diff --git a/ext/session/tests/session_set_save_handler_basic.phpt b/ext/session/tests/session_set_save_handler_basic.phpt
index 2a451c0644b55..459f03c825a6b 100644
--- a/ext/session/tests/session_set_save_handler_basic.phpt
+++ b/ext/session/tests/session_set_save_handler_basic.phpt
@@ -60,13 +60,13 @@ ob_end_flush();
*** Testing session_set_save_handler() : basic functionality ***
string(%d) "%s"
-Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+Warning: session_module_name(): Session handler module "" cannot be found in %s on line %d
bool(false)
-Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d
+Warning: session_module_name(): Session handler module "blah" cannot be found in %s on line %d
bool(false)
-Warning: session_module_name(): Cannot find named PHP session module (foo) in %s on line %d
+Warning: session_module_name(): Session handler module "foo" cannot be found in %s on line %d
bool(false)
Open [%s,PHPSESSID]
Read [%s,%s]
diff --git a/ext/session/tests/session_set_save_handler_class_012.phpt b/ext/session/tests/session_set_save_handler_class_012.phpt
index 601ca32b7f9df..0849013a8ff69 100644
--- a/ext/session/tests/session_set_save_handler_class_012.phpt
+++ b/ext/session/tests/session_set_save_handler_class_012.phpt
@@ -43,8 +43,6 @@ var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i
--EXPECTF--
*** Testing session_set_save_handler() : incorrect arguments for existing handler open ***
Open
-
-Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d
SessionHandler::open() expects exactly 2 arguments, 0 given
Warning: Undefined variable $_SESSION in %s on line %d
diff --git a/ext/session/tests/session_set_save_handler_class_014.phpt b/ext/session/tests/session_set_save_handler_class_014.phpt
index 6bb1fca5332c0..6eee4f8b6a31f 100644
--- a/ext/session/tests/session_set_save_handler_class_014.phpt
+++ b/ext/session/tests/session_set_save_handler_class_014.phpt
@@ -21,5 +21,5 @@ session_set_save_handler($handler);
session_start();
?>
--EXPECT--
-Recoverable fatal error: PHP Startup: Cannot set 'user' save handler by ini_set() or session_module_name() in Unknown on line 0
+Recoverable fatal error: PHP Startup: Session save handler "user" cannot be set by ini_set() or session_module_name() in Unknown on line 0
*** Testing session_set_save_handler() : calling default handler when save_handler=user ***
diff --git a/ext/session/tests/session_set_save_handler_closures.phpt b/ext/session/tests/session_set_save_handler_closures.phpt
index df5cfa6e7663b..535850ac3749a 100644
--- a/ext/session/tests/session_set_save_handler_closures.phpt
+++ b/ext/session/tests/session_set_save_handler_closures.phpt
@@ -47,13 +47,13 @@ ob_end_flush();
*** Testing session_set_save_handler() : using closures as callbacks ***
string(%d) "%s"
-Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+Warning: session_module_name(): Session handler module "" cannot be found in %s on line %d
bool(false)
-Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d
+Warning: session_module_name(): Session handler module "blah" cannot be found in %s on line %d
bool(false)
-Warning: session_module_name(): Cannot find named PHP session module (foo) in %s on line %d
+Warning: session_module_name(): Session handler module "foo" cannot be found in %s on line %d
bool(false)
Open [%s,PHPSESSID]
Read [%s,%s]
diff --git a/ext/session/tests/session_set_save_handler_error.phpt b/ext/session/tests/session_set_save_handler_error.phpt
index e47523c872322..34ee886012f8c 100644
--- a/ext/session/tests/session_set_save_handler_error.phpt
+++ b/ext/session/tests/session_set_save_handler_error.phpt
@@ -78,9 +78,13 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump(session_set_save_handler($input, NULL, NULL, NULL, NULL, NULL));
+ try {
+ session_set_save_handler($input, NULL, NULL, NULL, NULL, NULL);
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
$iterator++;
-};
+}
fclose($fp);
echo "Done";
@@ -90,122 +94,74 @@ ob_end_flush();
*** Testing session_set_save_handler() : error functionality ***
-- Iteration 1 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "0" not found or invalid function name
-- Iteration 2 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "1" not found or invalid function name
-- Iteration 3 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "12345" not found or invalid function name
-- Iteration 4 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "-2345" not found or invalid function name
-- Iteration 5 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "10.5" not found or invalid function name
-- Iteration 6 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "-10.5" not found or invalid function name
-- Iteration 7 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "123456789000" not found or invalid function name
-- Iteration 8 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "1.23456789E-9" not found or invalid function name
-- Iteration 9 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "0.5" not found or invalid function name
-- Iteration 10 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name
-- Iteration 11 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name
-- Iteration 12 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "1" not found or invalid function name
-- Iteration 13 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name
-- Iteration 14 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "1" not found or invalid function name
-- Iteration 15 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name
-- Iteration 16 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name
-- Iteration 17 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name
-- Iteration 18 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "Nothing" not found or invalid function name
-- Iteration 19 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "Nothing" not found or invalid function name
-- Iteration 20 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "Hello World!" not found or invalid function name
-- Iteration 21 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "classA::__invoke" not found or invalid function name
-- Iteration 22 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name
-- Iteration 23 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "" not found or invalid function name
-- Iteration 24 --
-
-Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be a valid callback, function "Resource id #%d" not found or invalid function name
Done
diff --git a/ext/session/tests/session_set_save_handler_error3.phpt b/ext/session/tests/session_set_save_handler_error3.phpt
index a57734e411248..bcf08fdc23d8f 100644
--- a/ext/session/tests/session_set_save_handler_error3.phpt
+++ b/ext/session/tests/session_set_save_handler_error3.phpt
@@ -29,8 +29,6 @@ ob_end_flush();
--EXPECTF--
*** Testing session_set_save_handler() : error functionality ***
-Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d
-
Fatal error: Uncaught Exception: Do something bad..! in %s:%d
Stack trace:
#0 [internal function]: open('', 'PHPSESSID')
diff --git a/ext/session/tests/session_set_save_handler_error4.phpt b/ext/session/tests/session_set_save_handler_error4.phpt
index 2b39cb55004ff..289a0712bed75 100644
--- a/ext/session/tests/session_set_save_handler_error4.phpt
+++ b/ext/session/tests/session_set_save_handler_error4.phpt
@@ -11,28 +11,54 @@ echo "*** Testing session_set_save_handler() : error functionality ***\n";
function callback() { return true; }
+try {
+ session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback");
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ session_set_save_handler("callback", "echo", "callback", "callback", "callback", "callback");
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ session_set_save_handler("callback", "callback", "echo", "callback", "callback", "callback");
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ session_set_save_handler("callback", "callback", "callback", "echo", "callback", "callback");
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ session_set_save_handler("callback", "callback", "callback", "callback", "echo", "callback");
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ session_set_save_handler("callback", "callback", "callback", "callback", "callback", "echo");
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback");
-session_set_save_handler("callback", "echo", "callback", "callback", "callback", "callback");
-session_set_save_handler("callback", "callback", "echo", "callback", "callback", "callback");
-session_set_save_handler("callback", "callback", "callback", "echo", "callback", "callback");
-session_set_save_handler("callback", "callback", "callback", "callback", "echo", "callback");
-session_set_save_handler("callback", "callback", "callback", "callback", "callback", "echo");
-session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback");
+
var_dump(session_start());
ob_end_flush();
?>
--EXPECTF--
*** Testing session_set_save_handler() : error functionality ***
-
-Warning: session_set_save_handler(): Argument 2 is not a valid callback in %s on line %d
-
-Warning: session_set_save_handler(): Argument 3 is not a valid callback in %s on line %d
-
-Warning: session_set_save_handler(): Argument 4 is not a valid callback in %s on line %d
-
-Warning: session_set_save_handler(): Argument 5 is not a valid callback in %s on line %d
-
-Warning: session_set_save_handler(): Argument 6 is not a valid callback in %s on line %d
+session_set_save_handler(): Argument #2 ($close) must be a valid callback, function "echo" not found or invalid function name
+session_set_save_handler(): Argument #3 ($read) must be a valid callback, function "echo" not found or invalid function name
+session_set_save_handler(): Argument #4 ($write) must be a valid callback, function "echo" not found or invalid function name
+session_set_save_handler(): Argument #5 ($destroy) must be a valid callback, function "echo" not found or invalid function name
+session_set_save_handler(): Argument #6 ($gc) must be a valid callback, function "echo" not found or invalid function name
Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
bool(false)
diff --git a/ext/session/tests/session_set_save_handler_iface_002.phpt b/ext/session/tests/session_set_save_handler_iface_002.phpt
index eed5ee2f8d342..10971a2b5f031 100644
--- a/ext/session/tests/session_set_save_handler_iface_002.phpt
+++ b/ext/session/tests/session_set_save_handler_iface_002.phpt
@@ -83,3 +83,5 @@ session_start();
bool(true)
session_set_save_handler(): Argument #1 ($open) must be of type SessionHandlerInterface, MySession2 given
good handler writing
+
+Deprecated: Unknown: Session callback must have a return value of type bool, int returned in Unknown on line 0
diff --git a/ext/session/tests/session_set_save_handler_sid_002.phpt b/ext/session/tests/session_set_save_handler_sid_002.phpt
index 5f288fd826e96..6321c5a5681c8 100644
--- a/ext/session/tests/session_set_save_handler_sid_002.phpt
+++ b/ext/session/tests/session_set_save_handler_sid_002.phpt
@@ -78,10 +78,5 @@ session_unset();
Fatal error: Uncaught Error: Session id must be a string in %s:%d
Stack trace:
#0 %s(%d): session_start()
-#1 {main}
-
-Next Error: Failed to create session ID: user (path: %s) in %s:%d
-Stack trace:
-#0 %s(%d): session_start()
#1 {main}
thrown in %s on line %d
diff --git a/ext/session/tests/session_set_save_handler_type_error.phpt b/ext/session/tests/session_set_save_handler_type_error.phpt
new file mode 100644
index 0000000000000..67c4753d86635
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_type_error.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test session_set_save_handler() function: interface wrong
+--SKIPIF--
+
+--INI--
+session.name=PHPSESSID
+session.save_handler=files
+--FILE--
+getMessage() . "\n";
+}
+
+try {
+ $ret = session_set_save_handler($deprecatedCallback, $validCallback, $validCallback, $validCallback, $validCallback, $validCallback);
+ session_start();
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ $ret = session_set_save_handler($validCallback, $exceptionCallback, $validCallback, $validCallback, $validCallback, $validCallback);
+ session_start();
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ $ret = session_set_save_handler($validCallback, $deprecatedCallback, $exceptionCallback, $validCallback, $validCallback, $validCallback);
+ session_start();
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+ob_end_flush();
+
+?>
+--EXPECTF--
+Session callback must have a return value of type bool, array returned
+
+Deprecated: session_start(): Session callback must have a return value of type bool, int returned in %s on line %d
+
+Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
+Session callback must have a return value of type bool, array returned
+
+Deprecated: session_start(): Session callback must have a return value of type bool, int returned in %s on line %d
+
+Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
diff --git a/ext/session/tests/session_set_save_handler_variation1.phpt b/ext/session/tests/session_set_save_handler_variation1.phpt
index e192ac8838992..7e3a749aade73 100644
--- a/ext/session/tests/session_set_save_handler_variation1.phpt
+++ b/ext/session/tests/session_set_save_handler_variation1.phpt
@@ -23,11 +23,11 @@ ob_end_flush();
*** Testing session_set_save_handler() : variation ***
string(%d) "%s"
-Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+Warning: session_module_name(): Session handler module "" cannot be found in %s on line %d
bool(false)
string(%d) "%s"
-Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d
+Warning: session_module_name(): Session handler module "blah" cannot be found in %s on line %d
bool(false)
string(%d) "%s"
string(%d) "%s"
diff --git a/ext/session/tests/session_set_save_handler_variation2.phpt b/ext/session/tests/session_set_save_handler_variation2.phpt
index 394d85e7b167b..224846466e1af 100644
--- a/ext/session/tests/session_set_save_handler_variation2.phpt
+++ b/ext/session/tests/session_set_save_handler_variation2.phpt
@@ -22,6 +22,6 @@ ob_end_flush();
*** Testing session_set_save_handler() : variation ***
bool(true)
-Warning: session_set_save_handler(): Cannot change save handler when session is active in %s on line %d
+Warning: session_set_save_handler(): Session save handler cannot be changed when a session is active in %s on line %d
bool(false)
bool(true)
diff --git a/ext/session/tests/session_set_save_handler_variation3.phpt b/ext/session/tests/session_set_save_handler_variation3.phpt
index 50fa6f62e05de..be825cbe7234f 100644
--- a/ext/session/tests/session_set_save_handler_variation3.phpt
+++ b/ext/session/tests/session_set_save_handler_variation3.phpt
@@ -24,8 +24,8 @@ ob_end_flush();
*** Testing session_set_save_handler() : variation ***
int(2)
-Warning: session_save_path(): Cannot change save path when session is active in %s on line %d
+Warning: session_save_path(): Session save path cannot be changed when a session is active in %s on line %d
-Warning: session_set_save_handler(): Cannot change save handler when session is active in %s on line %d
+Warning: session_set_save_handler(): Session save handler cannot be changed when a session is active in %s on line %d
bool(false)
bool(true)
diff --git a/ext/session/tests/session_start_error.phpt b/ext/session/tests/session_start_error.phpt
new file mode 100644
index 0000000000000..ccfdada6f6ea6
--- /dev/null
+++ b/ext/session/tests/session_start_error.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test session_start() errors
+--SKIPIF--
+
+--FILE--
+ new stdClass()]);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+var_dump(session_start(['option' => false]));
+
+ob_end_flush();
+
+?>
+--EXPECTF--
+session_start(): Option "option" must be of type string|int|bool, stdClass given
+
+Warning: session_start(): Setting option "option" failed in %s on line %d
+bool(true)
diff --git a/ext/session/tests/session_start_variation1.phpt b/ext/session/tests/session_start_variation1.phpt
index b34abbacddce7..aac1e513899c6 100644
--- a/ext/session/tests/session_start_variation1.phpt
+++ b/ext/session/tests/session_start_variation1.phpt
@@ -23,15 +23,15 @@ ob_end_flush();
*** Testing session_start() : variation ***
bool(true)
-Notice: session_start(): A session had already been started - ignoring in %s on line %d
+Notice: session_start(): Ignoring session_start() because a session is already active in %s on line %d
bool(true)
-Notice: session_start(): A session had already been started - ignoring in %s on line %d
+Notice: session_start(): Ignoring session_start() because a session is already active in %s on line %d
bool(true)
-Notice: session_start(): A session had already been started - ignoring in %s on line %d
+Notice: session_start(): Ignoring session_start() because a session is already active in %s on line %d
bool(true)
-Notice: session_start(): A session had already been started - ignoring in %s on line %d
+Notice: session_start(): Ignoring session_start() because a session is already active in %s on line %d
bool(true)
Done
diff --git a/ext/session/tests/session_start_variation9.phpt b/ext/session/tests/session_start_variation9.phpt
index 99740c0b92af5..7e5c465a35b5a 100644
--- a/ext/session/tests/session_start_variation9.phpt
+++ b/ext/session/tests/session_start_variation9.phpt
@@ -24,7 +24,7 @@ ob_end_flush();
*** Testing session_start() : variation ***
string(%d) "%s"
-Notice: session_start(): A session had already been started - ignoring in %s on line %d
+Notice: session_start(): Ignoring session_start() because a session is already active in %s on line %d
bool(true)
string(%d) "%s"
bool(true)