diff --git a/ext/session/session.c b/ext/session/session.c
index 32de7c36d7813..346b3d74253ce 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -808,6 +808,40 @@ static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
return SUCCESS;
} /* }}} */
+static PHP_INI_MH(OnUpdateUseOnlyCookies)
+{
+ SESSION_CHECK_ACTIVE_STATE;
+ SESSION_CHECK_OUTPUT_STATE;
+ bool *p = (bool *) ZEND_INI_GET_ADDR();
+ *p = zend_ini_parse_bool(new_value);
+ if (!*p) {
+ php_error_docref("session.configuration", E_DEPRECATED, "Disabling session.use_only_cookies INI setting is deprecated");
+ }
+ return SUCCESS;
+}
+
+static PHP_INI_MH(OnUpdateUseTransSid)
+{
+ SESSION_CHECK_ACTIVE_STATE;
+ SESSION_CHECK_OUTPUT_STATE;
+ bool *p = (bool *) ZEND_INI_GET_ADDR();
+ *p = zend_ini_parse_bool(new_value);
+ if (*p) {
+ php_error_docref("session.configuration", E_DEPRECATED, "Enabling session.use_trans_sid INI setting is deprecated");
+ }
+ return SUCCESS;
+}
+
+static PHP_INI_MH(OnUpdateRefererCheck)
+{
+ SESSION_CHECK_ACTIVE_STATE;
+ SESSION_CHECK_OUTPUT_STATE;
+ if (ZSTR_LEN(new_value) != 0) {
+ php_error_docref("session.configuration", E_DEPRECATED, "Usage of session.referer_check INI setting is deprecated");
+ }
+ return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
+}
+
/* {{{ PHP_INI */
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("session.save_path", "", PHP_INI_ALL, OnUpdateSaveDir, save_path, php_ps_globals, ps_globals)
@@ -825,12 +859,12 @@ PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("session.cookie_httponly", "0", PHP_INI_ALL, OnUpdateSessionBool, cookie_httponly, php_ps_globals, ps_globals)
STD_PHP_INI_ENTRY("session.cookie_samesite", "", PHP_INI_ALL, OnUpdateSessionString, cookie_samesite, php_ps_globals, ps_globals)
STD_PHP_INI_BOOLEAN("session.use_cookies", "1", PHP_INI_ALL, OnUpdateSessionBool, use_cookies, php_ps_globals, ps_globals)
- STD_PHP_INI_BOOLEAN("session.use_only_cookies", "1", PHP_INI_ALL, OnUpdateSessionBool, use_only_cookies, php_ps_globals, ps_globals)
+ STD_PHP_INI_BOOLEAN("session.use_only_cookies", "1", PHP_INI_ALL, OnUpdateUseOnlyCookies, use_only_cookies, php_ps_globals, ps_globals)
STD_PHP_INI_BOOLEAN("session.use_strict_mode", "0", PHP_INI_ALL, OnUpdateSessionBool, use_strict_mode, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, OnUpdateSessionString, extern_referer_chk, php_ps_globals, ps_globals)
+ STD_PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, OnUpdateRefererCheck, extern_referer_chk, php_ps_globals, ps_globals)
STD_PHP_INI_ENTRY("session.cache_limiter", "nocache", PHP_INI_ALL, OnUpdateSessionString, cache_limiter, php_ps_globals, ps_globals)
STD_PHP_INI_ENTRY("session.cache_expire", "180", PHP_INI_ALL, OnUpdateSessionLong, cache_expire, php_ps_globals, ps_globals)
- STD_PHP_INI_BOOLEAN("session.use_trans_sid", "0", PHP_INI_ALL, OnUpdateSessionBool, use_trans_sid, php_ps_globals, ps_globals)
+ STD_PHP_INI_BOOLEAN("session.use_trans_sid", "0", PHP_INI_ALL, OnUpdateUseTransSid, use_trans_sid, php_ps_globals, ps_globals)
PHP_INI_ENTRY("session.sid_length", "32", PHP_INI_ALL, OnUpdateSidLength)
PHP_INI_ENTRY("session.sid_bits_per_character", "4", PHP_INI_ALL, OnUpdateSidBits)
STD_PHP_INI_BOOLEAN("session.lazy_write", "1", PHP_INI_ALL, OnUpdateSessionBool, lazy_write, php_ps_globals, ps_globals)
@@ -1478,7 +1512,7 @@ PHPAPI zend_result php_session_reset_id(void) /* {{{ */
zval_ptr_dtor_str(sid);
ZVAL_STR(sid, smart_str_extract(&var));
} else {
- REGISTER_STRINGL_CONSTANT("SID", ZSTR_VAL(var.s), ZSTR_LEN(var.s), 0);
+ REGISTER_STRINGL_CONSTANT("SID", ZSTR_VAL(var.s), ZSTR_LEN(var.s), CONST_DEPRECATED);
smart_str_free(&var);
}
} else {
@@ -1486,7 +1520,7 @@ PHPAPI zend_result php_session_reset_id(void) /* {{{ */
zval_ptr_dtor_str(sid);
ZVAL_EMPTY_STRING(sid);
} else {
- REGISTER_STRINGL_CONSTANT("SID", "", 0, 0);
+ REGISTER_STRINGL_CONSTANT("SID", "", 0, CONST_DEPRECATED);
}
}
diff --git a/ext/session/tests/015.phpt b/ext/session/tests/015.phpt
index 1d6e9d65fe67e..3154022fae861 100644
--- a/ext/session/tests/015.phpt
+++ b/ext/session/tests/015.phpt
@@ -20,10 +20,16 @@ error_reporting(E_ALL);
session_id("test015");
session_start();
+$sid = SID;
?>
-
+
---EXPECT--
+--EXPECTF--
+Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
+
+Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
+
+Deprecated: Constant SID is deprecated in %s on line 6
diff --git a/ext/session/tests/018.phpt b/ext/session/tests/018.phpt
index f504f120d6b10..5d9c6eb6261b1 100644
--- a/ext/session/tests/018.phpt
+++ b/ext/session/tests/018.phpt
@@ -26,4 +26,7 @@ session_start();
session_destroy();
?>
--EXPECT--
+Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
+
+Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0