summaryrefslogtreecommitdiff
path: root/ext/session/session.c
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2020-09-22 18:32:21 +0100
committerGeorge Peter Banyard <girgias@php.net>2020-09-22 19:11:30 +0100
commit82e14ff8e77cf818e3727b2efa46c0fc4e9db0dc (patch)
treea7d26d2e614c1330c7f5d82c61fbd79f61d7fc2f /ext/session/session.c
parent5d7d5e2773d140be3c31a27be45e89cae0d218e2 (diff)
downloadphp-git-82e14ff8e77cf818e3727b2efa46c0fc4e9db0dc.tar.gz
Drop usage of E_RECOVERABLE_ERROR in Session extension
Diffstat (limited to 'ext/session/session.c')
-rw-r--r--ext/session/session.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/ext/session/session.c b/ext/session/session.c
index 79b82f90f7..bf05a547ac 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -536,21 +536,18 @@ static void php_session_normalize_vars() /* {{{ */
static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
{
const ps_module *tmp;
+ int err_type = E_ERROR;
SESSION_CHECK_ACTIVE_STATE;
SESSION_CHECK_OUTPUT_STATE;
tmp = _php_find_ps_module(ZSTR_VAL(new_value));
- if (PG(modules_activated) && !tmp) {
- int err_type;
-
- if (stage == ZEND_INI_STAGE_RUNTIME) {
- err_type = E_WARNING;
- } else {
- err_type = E_ERROR;
- }
+ if (stage == ZEND_INI_STAGE_RUNTIME) {
+ err_type = E_WARNING;
+ }
+ if (PG(modules_activated) && !tmp) {
/* Do not output error when restoring ini options. */
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
php_error_docref(NULL, err_type, "Session save handler \"%s\" cannot be found", ZSTR_VAL(new_value));
@@ -561,7 +558,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, "Session save handler \"user\" cannot be set by ini_set() or session_module_name()");
+ php_error_docref(NULL, err_type, "Session save handler \"user\" cannot be set by ini_set()");
return FAILURE;
}
@@ -1917,6 +1914,10 @@ PHP_FUNCTION(session_module_name)
}
if (name) {
+ if (zend_string_equals_literal_ci(name, "user")) {
+ zend_argument_value_error(1, "cannot be \"user\"");
+ RETURN_THROWS();
+ }
if (!_php_find_ps_module(ZSTR_VAL(name))) {
php_error_docref(NULL, E_WARNING, "Session handler module \"%s\" cannot be found", ZSTR_VAL(name));