Deprecate disabling use_only_cookies (#13578)

This commit is contained in:
Kamil Tekiela 2024-08-24 16:33:45 +02:00 committed by GitHub
parent 9c267778d2
commit c5bce0d8a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 233 additions and 25 deletions

View file

@ -846,6 +846,40 @@ static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
return SUCCESS; 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 */
PHP_INI_BEGIN() PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("session.save_path", "", PHP_INI_ALL, OnUpdateSaveDir, save_path, php_ps_globals, ps_globals) STD_PHP_INI_ENTRY("session.save_path", "", PHP_INI_ALL, OnUpdateSaveDir, save_path, php_ps_globals, ps_globals)
@ -863,12 +897,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_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_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_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_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_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_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_length", "32", PHP_INI_ALL, OnUpdateSidLength)
PHP_INI_ENTRY("session.sid_bits_per_character", "4", PHP_INI_ALL, OnUpdateSidBits) 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) STD_PHP_INI_BOOLEAN("session.lazy_write", "1", PHP_INI_ALL, OnUpdateSessionBool, lazy_write, php_ps_globals, ps_globals)
@ -1516,7 +1550,7 @@ PHPAPI zend_result php_session_reset_id(void) /* {{{ */
zval_ptr_dtor_str(sid); zval_ptr_dtor_str(sid);
ZVAL_STR(sid, smart_str_extract(&var)); ZVAL_STR(sid, smart_str_extract(&var));
} else { } 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); smart_str_free(&var);
} }
} else { } else {
@ -1524,7 +1558,7 @@ PHPAPI zend_result php_session_reset_id(void) /* {{{ */
zval_ptr_dtor_str(sid); zval_ptr_dtor_str(sid);
ZVAL_EMPTY_STRING(sid); ZVAL_EMPTY_STRING(sid);
} else { } else {
REGISTER_STRINGL_CONSTANT("SID", "", 0, 0); REGISTER_STRINGL_CONSTANT("SID", "", 0, CONST_DEPRECATED);
} }
} }

View file

@ -20,10 +20,16 @@ error_reporting(E_ALL);
session_id("test015"); session_id("test015");
session_start(); session_start();
$sid = SID;
?> ?>
<a href="/link?<?php echo SID; ?>"> <a href="/link?<?=$sid ?>">
<?php <?php
session_destroy(); session_destroy();
?> ?>
--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
<a href="/link?PHPSESSID=test015&PHPSESSID=test015"> <a href="/link?PHPSESSID=test015&PHPSESSID=test015">

View file

@ -26,4 +26,7 @@ session_start();
session_destroy(); session_destroy();
?> ?>
--EXPECT-- --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
<form accept-charset="ISO-8859-15, ISO-8859-1" action=url.php><input type="hidden" name="PHPSESSID" value="test018" /> <form accept-charset="ISO-8859-15, ISO-8859-1" action=url.php><input type="hidden" name="PHPSESSID" value="test018" />

View file

@ -27,4 +27,7 @@ session_start();
session_destroy(); session_destroy();
?> ?>
--EXPECT-- --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
<a href="link.php?a=b&amp;PHPSESSID=test020"> <a href="link.php?a=b&amp;PHPSESSID=test020">

View file

@ -59,7 +59,12 @@ ini_set("url_rewriter.tags", "a=href,fieldset=,area=href,frame=src,input=src");
session_destroy(); session_destroy();
?> ?>
--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: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 4
<form action="//bad.net/do.php"> <form action="//bad.net/do.php">
<fieldset> <fieldset>
<form action="//php.net/do.php"><input type="hidden" name="PHPSESSID" value="test021" /> <form action="//php.net/do.php"><input type="hidden" name="PHPSESSID" value="test021" />

View file

@ -30,6 +30,9 @@ session_start();
</body> </body>
</html> </html>
--EXPECTF-- --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
<html> <html>
<head> <head>
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title> <title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>

View file

@ -27,4 +27,7 @@ session_start();
session_destroy(); session_destroy();
?> ?>
--EXPECT-- --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
<a href="link.php?a=b&amp;PHPSESSID=bug41600"> <a href="link.php?a=b&amp;PHPSESSID=bug41600">

View file

@ -34,5 +34,6 @@ foreach (glob($sessdir. "*") as $sessfile) {
rmdir($sessdir); rmdir($sessdir);
?> ?>
--EXPECT-- --EXPECT--
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
hello world hello world
string(6) "100777" string(6) "100777"

View file

@ -25,6 +25,9 @@ session.use_only_cookies=0
<a href=./> <a href=./>
<a href="./"> <a href="./">
--EXPECTF-- --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
<a href="?PHPSESSID=%s"/> <a href="?PHPSESSID=%s"/>
<a href="?PHPSESSID=%s" /> <a href="?PHPSESSID=%s" />
<a href="foo?PHPSESSID=%s"/> <a href="foo?PHPSESSID=%s"/>

View file

@ -13,6 +13,7 @@ session_start();
print_r(ob_list_handlers()); print_r(ob_list_handlers());
?> ?>
--EXPECT-- --EXPECT--
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
Array Array
( (
) )

View file

@ -14,4 +14,5 @@ ob_start();
echo "ok\n"; echo "ok\n";
?> ?>
--EXPECT-- --EXPECT--
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
ok ok

View file

@ -5,6 +5,7 @@ session
--SKIPIF-- --SKIPIF--
<?php include('skipif.inc'); ?> <?php include('skipif.inc'); ?>
--INI-- --INI--
display_startup_errors=0
session.save_handler=files session.save_handler=files
session.auto_start=0 session.auto_start=0
session.use_cookies=1 session.use_cookies=1

View file

@ -31,8 +31,15 @@ session_start();
var_dump(session_id(), SID); var_dump(session_id(), SID);
session_destroy(); session_destroy();
?> ?>
--EXPECT-- --EXPECTF--
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 6
Deprecated: Constant SID is deprecated in %s on line 8
string(12) "bug72940test" string(12) "bug72940test"
string(0) "" string(0) ""
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 13
Deprecated: Constant SID is deprecated in %s on line 15
string(11) "bug72940get" string(11) "bug72940get"
string(21) "PHPSESSID=bug72940get" string(21) "PHPSESSID=bug72940get"

View file

@ -1,15 +1,17 @@
--TEST-- --TEST--
Bug #74892 Url Rewriting (trans_sid) not working on urls that start with # Bug #74892 Url Rewriting (trans_sid) not working on urls that start with #
--INI--
session.use_cookies=0
session.use_only_cookies=0
session.use_trans_sid=1
--EXTENSIONS-- --EXTENSIONS--
session session
--SKIPIF-- --SKIPIF--
<?php include('skipif.inc'); ?> <?php include('skipif.inc'); ?>
--FILE-- --FILE--
<?php <?php
ini_set('session.use_cookies', '0'); ob_start();
ini_set('session.use_only_cookies',0); ini_set('session.trans_sid_hosts','php.net'); // This value cannot be set in the INI file
ini_set('session.use_trans_sid',1);
ini_set('session.trans_sid_hosts','php.net');
session_id('sessionidhere'); session_id('sessionidhere');
session_start(); session_start();
@ -18,7 +20,12 @@ session_start();
<p><a href="index.php#place">External link with anchor</a></p> <p><a href="index.php#place">External link with anchor</a></p>
<p><a href="http://php.net#foo">External link with anchor 2</a></p> <p><a href="http://php.net#foo">External link with anchor 2</a></p>
<p><a href="#place">Internal link</a></p> <p><a href="#place">Internal link</a></p>
--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: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 3
<p><a href="index.php?PHPSESSID=sessionidhere">Click This Anchor Tag!</a></p> <p><a href="index.php?PHPSESSID=sessionidhere">Click This Anchor Tag!</a></p>
<p><a href="index.php?PHPSESSID=sessionidhere#place">External link with anchor</a></p> <p><a href="index.php?PHPSESSID=sessionidhere#place">External link with anchor</a></p>
<p><a href="http://php.net?PHPSESSID=sessionidhere#foo">External link with anchor 2</a></p> <p><a href="http://php.net?PHPSESSID=sessionidhere#foo">External link with anchor 2</a></p>

View file

@ -0,0 +1,64 @@
--TEST--
Deprecated GET/POST sessions
--EXTENSIONS--
session
--SKIPIF--
<?php include 'skipif.inc'; ?>
--INI--
session.use_cookies=0
session.use_only_cookies=1
session.use_trans_sid=0
--FILE--
<?php
ob_start();
// Expecting deprecation here
ini_set("session.use_only_cookies", "0");
// Expecting no deprecation
ini_set("session.use_only_cookies", "1");
// Expecting deprecation here
ini_set("session.use_trans_sid", "1");
// Expecting no deprecation
ini_set("session.use_trans_sid", "0");
// Expecting deprecation here
ini_set("session.trans_sid_tags", "a=href");
// Expecting no deprecation (default value)
ini_set("session.trans_sid_tags", "a=href,area=href,frame=src,form=");
// Expecting deprecation here
ini_set("session.trans_sid_hosts", "php.net");
// Expecting no deprecation (default value)
ini_set("session.trans_sid_hosts", "");
// Expecting deprecation here
ini_set("session.referer_check", "php.net");
// Expecting no deprecation (default value)
ini_set("session.referer_check", "");
// Setting deprecated values directly in session_start()
// Expecting deprecation here
session_start([ 'use_cookies' => '0', 'use_only_cookies' => '0', 'use_trans_sid' => '1']);
echo SID;
?>
--EXPECTF--
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 6
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 11
Deprecated: ini_set(): Usage of session.trans_sid_tags INI setting is deprecated in %s on line 16
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 21
Deprecated: ini_set(): Usage of session.referer_check INI setting is deprecated in %s on line 26
Deprecated: session_start(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 32
Deprecated: session_start(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 32
Deprecated: Constant SID is deprecated in %s on line 34
PHPSESSID=%s

View file

@ -14,4 +14,13 @@ session
// We *must* set it here because the bug only triggers on a runtime edit // We *must* set it here because the bug only triggers on a runtime edit
ini_set('session.trans_sid_hosts','php.net'); ini_set('session.trans_sid_hosts','php.net');
?> ?>
--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: PHP Startup: Usage of session.trans_sid_hosts INI setting is deprecated in Unknown on line 0
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 3
Deprecated: PHP Request Shutdown: Usage of session.trans_sid_hosts INI setting is deprecated in Unknown on line 0

View file

@ -1,6 +1,7 @@
--TEST-- --TEST--
session rfc1867 session rfc1867
--INI-- --INI--
display_startup_errors=0
file_uploads=1 file_uploads=1
upload_max_filesize=1024 upload_max_filesize=1024
session.save_path= session.save_path=

View file

@ -1,6 +1,7 @@
--TEST-- --TEST--
session rfc1867 session rfc1867
--INI-- --INI--
display_startup_errors=0
file_uploads=1 file_uploads=1
upload_max_filesize=1024 upload_max_filesize=1024
session.save_path= session.save_path=

View file

@ -1,6 +1,7 @@
--TEST-- --TEST--
session rfc1867 disabled session rfc1867 disabled
--INI-- --INI--
display_startup_errors=0
file_uploads=1 file_uploads=1
upload_max_filesize=1024 upload_max_filesize=1024
session.save_path= session.save_path=

View file

@ -1,6 +1,7 @@
--TEST-- --TEST--
session rfc1867 disabled 2 session rfc1867 disabled 2
--INI-- --INI--
display_startup_errors=0
file_uploads=1 file_uploads=1
upload_max_filesize=1024 upload_max_filesize=1024
session.save_path= session.save_path=

View file

@ -1,6 +1,7 @@
--TEST-- --TEST--
session rfc1867 session rfc1867
--INI-- --INI--
display_startup_errors=0
file_uploads=1 file_uploads=1
upload_max_filesize=1024 upload_max_filesize=1024
session.save_path= session.save_path=

View file

@ -1,6 +1,7 @@
--TEST-- --TEST--
session rfc1867 no name session rfc1867 no name
--INI-- --INI--
display_startup_errors=0
file_uploads=1 file_uploads=1
upload_max_filesize=1024 upload_max_filesize=1024
session.save_path= session.save_path=

View file

@ -1,6 +1,7 @@
--TEST-- --TEST--
session rfc1867 sid cookie session rfc1867 sid cookie
--INI-- --INI--
display_startup_errors=0
file_uploads=1 file_uploads=1
upload_max_filesize=1024 upload_max_filesize=1024
session.save_path= session.save_path=

View file

@ -1,6 +1,7 @@
--TEST-- --TEST--
session rfc1867 sid get session rfc1867 sid get
--INI-- --INI--
display_startup_errors=0
file_uploads=1 file_uploads=1
upload_max_filesize=1024 upload_max_filesize=1024
session.save_path= session.save_path=

View file

@ -1,6 +1,7 @@
--TEST-- --TEST--
session rfc1867 sid get 2 session rfc1867 sid get 2
--INI-- --INI--
display_startup_errors=0
file_uploads=1 file_uploads=1
upload_max_filesize=1024 upload_max_filesize=1024
session.save_path= session.save_path=

View file

@ -6,7 +6,6 @@ upload_max_filesize=1024
session.save_path= session.save_path=
session.name=PHPSESSID session.name=PHPSESSID
session.use_cookies=1 session.use_cookies=1
session.use_only_cookies=0
session.use_strict_mode=0 session.use_strict_mode=0
session.auto_start=0 session.auto_start=0
session.upload_progress.enabled=1 session.upload_progress.enabled=1

View file

@ -1,6 +1,7 @@
--TEST-- --TEST--
session rfc1867 sid post session rfc1867 sid post
--INI-- --INI--
display_startup_errors=0
file_uploads=1 file_uploads=1
upload_max_filesize=1024 upload_max_filesize=1024
session.save_path= session.save_path=

View file

@ -222,6 +222,9 @@ var_dump(session_destroy());
ob_end_flush(); ob_end_flush();
?> ?>
--EXPECT-- --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
*** Testing basic session functionality : variation3 use_trans_sid *** *** Testing basic session functionality : variation3 use_trans_sid ***
*** Test trans sid *** *** Test trans sid ***

View file

@ -48,6 +48,9 @@ echo '
'; ';
?> ?>
--EXPECT-- --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
*** Testing basic session functionality : variation4 use_trans_sid *** *** Testing basic session functionality : variation4 use_trans_sid ***
*** Test trans sid *** *** Test trans sid ***

View file

@ -234,7 +234,12 @@ var_dump(session_destroy());
ob_end_flush(); ob_end_flush();
?> ?>
--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: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 5
*** Testing basic session functionality : variation5 use_trans_sid *** *** Testing basic session functionality : variation5 use_trans_sid ***
*** Test trans sid *** *** Test trans sid ***

View file

@ -5,12 +5,12 @@ session
--INI-- --INI--
session.name=PHPSESSID session.name=PHPSESSID
session.use_only_cookies=0 session.use_only_cookies=0
session.use_trans_sid=1
session.trans_sid_tags="a=href,area=href,frame=src,form=" session.trans_sid_tags="a=href,area=href,frame=src,form="
url_rewriter.tags="a=href,area=href,frame=src,form=" url_rewriter.tags="a=href,area=href,frame=src,form="
--FILE-- --FILE--
<?php <?php
ini_set('session.use_trans_sid', 1);
session_save_path(__DIR__); session_save_path(__DIR__);
session_start(); session_start();
@ -34,4 +34,7 @@ foreach (glob(__DIR__ . '/sess_*') as $filename) {
} }
?> ?>
--EXPECTF-- --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
<a href='a?q=1&a=b&PHPSESSID=%s'>asd</a> <a href='a?q=1&a=b&PHPSESSID=%s'>asd</a>

View file

@ -74,7 +74,10 @@ Test use_trans_sid=1
<form action="http://php.net/bar.php" method="get"> </form> <form action="http://php.net/bar.php" method="get"> </form>
<form action="bad://php.net/bar.php" method="get"> </form> <form action="bad://php.net/bar.php" method="get"> </form>
<form action="//www.php.net/bar.php" method="get"> </form> <form action="//www.php.net/bar.php" method="get"> </form>
--EXPECT-- --EXPECTF--
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 5
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 6
Without session Without session
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
@ -105,6 +108,8 @@ Test use_trans_sid=0
<form action="bad://php.net/bar.php" method="get"> </form> <form action="bad://php.net/bar.php" method="get"> </form>
<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </form> <form action="//www.php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </form>
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 50
Test use_trans_sid=1 Test use_trans_sid=1
<a href="?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a> <a href="?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a>
<a href="./foo.php?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a> <a href="./foo.php?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a>

View file

@ -74,7 +74,8 @@ Test use_trans_sid=1
<form action="http://php.net/bar.php" method="get"> </a> <form action="http://php.net/bar.php" method="get"> </a>
<form action="bad://php.net/bar.php" method="get"> </a> <form action="bad://php.net/bar.php" method="get"> </a>
<form action="//www.php.net/bar.php" method="get"> </a> <form action="//www.php.net/bar.php" method="get"> </a>
--EXPECT-- --EXPECTF--
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 5
Without session Without session
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
@ -105,6 +106,8 @@ Test use_trans_sid=0
<form action="bad://php.net/bar.php" method="get"> </a> <form action="bad://php.net/bar.php" method="get"> </a>
<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a> <form action="//www.php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 50
Test use_trans_sid=1 Test use_trans_sid=1
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>

View file

@ -73,7 +73,8 @@ Test use_trans_sid=1
<form action="http://php.net/bar.php" method="get"> </a> <form action="http://php.net/bar.php" method="get"> </a>
<form action="bad://php.net/bar.php" method="get"> </a> <form action="bad://php.net/bar.php" method="get"> </a>
<form action="//www.php.net/bar.php" method="get"> </a> <form action="//www.php.net/bar.php" method="get"> </a>
--EXPECT-- --EXPECTF--
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 5
Without session Without session
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
@ -104,6 +105,8 @@ Test use_trans_sid=0
<form action="bad://php.net/bar.php" method="get"> </a> <form action="bad://php.net/bar.php" method="get"> </a>
<form action="//www.php.net/bar.php" method="get"> </a> <form action="//www.php.net/bar.php" method="get"> </a>
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 49
Test use_trans_sid=1 Test use_trans_sid=1
<a href="?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a> <a href="?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a>
<a href="./foo.php?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a> <a href="./foo.php?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a>

View file

@ -73,7 +73,7 @@ Test use_trans_sid=1
<form action="http://php.net/bar.php" method="get"> </a> <form action="http://php.net/bar.php" method="get"> </a>
<form action="bad://php.net/bar.php" method="get"> </a> <form action="bad://php.net/bar.php" method="get"> </a>
<form action="//www.php.net/bar.php" method="get"> </a> <form action="//www.php.net/bar.php" method="get"> </a>
--EXPECT-- --EXPECTF--
Without session Without session
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
@ -104,6 +104,8 @@ Test use_trans_sid=0
<form action="bad://php.net/bar.php" method="get"> </a> <form action="bad://php.net/bar.php" method="get"> </a>
<form action="//www.php.net/bar.php" method="get"> </a> <form action="//www.php.net/bar.php" method="get"> </a>
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 49
Test use_trans_sid=1 Test use_trans_sid=1
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> <a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>

View file

@ -76,7 +76,8 @@ session_start();
echo "\nURL-Rewriting with transparent session id support without output_add_rewrite_var()\n"; echo "\nURL-Rewriting with transparent session id support without output_add_rewrite_var()\n";
echo $testTags; echo $testTags;
--EXPECT-- --EXPECTF--
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 44
URL-Rewriting with output_add_rewrite_var() without transparent session id support URL-Rewriting with output_add_rewrite_var() without transparent session id support
<a href="?%3Cname%3E=%3Cvalue%3E"></a> <a href="?%3Cname%3E=%3Cvalue%3E"></a>
@ -115,6 +116,10 @@ URL-Rewriting with output_add_rewrite_var() without transparent session id suppo
<form action="bad://url-rewriter.com/bar.php" method="get"></form> <form action="bad://url-rewriter.com/bar.php" method="get"></form>
<form action="//www.url-rewriter.com/bar.php" method="get"></form> <form action="//www.url-rewriter.com/bar.php" method="get"></form>
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 60
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 63
URL-Rewriting with transparent session id support without output_add_rewrite_var() URL-Rewriting with transparent session id support without output_add_rewrite_var()
<a href="?PHPSESSID=testid"></a> <a href="?PHPSESSID=testid"></a>

View file

@ -87,7 +87,8 @@ output_add_rewrite_var('<name2>', '<value2>');
echo "\nURL-Rewriting with output_add_rewrite_var() without transparent session id support\n"; echo "\nURL-Rewriting with output_add_rewrite_var() without transparent session id support\n";
echo $testTags; echo $testTags;
--EXPECT-- --EXPECTF--
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 44
URL-Rewriting with output_add_rewrite_var() without transparent session id support URL-Rewriting with output_add_rewrite_var() without transparent session id support
<a href="?%3Cname%3E=%3Cvalue%3E"></a> <a href="?%3Cname%3E=%3Cvalue%3E"></a>
@ -126,6 +127,10 @@ URL-Rewriting with output_add_rewrite_var() without transparent session id suppo
<form action="bad://url-rewriter.com/bar.php" method="get"></form> <form action="bad://url-rewriter.com/bar.php" method="get"></form>
<form action="//www.url-rewriter.com/bar.php" method="get"></form> <form action="//www.url-rewriter.com/bar.php" method="get"></form>
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 61
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 64
URL-Rewriting with transparent session id support without output_add_rewrite_var() URL-Rewriting with transparent session id support without output_add_rewrite_var()
<a href="?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E&%3Cname2%3E=%3Cvalue2%3E"></a> <a href="?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E&%3Cname2%3E=%3Cvalue2%3E"></a>

View file

@ -80,7 +80,12 @@ output_add_rewrite_var('<name2>', '<value2>');
echo "\nURL-Rewriting with transparent session id support without output_add_rewrite_var()\n"; echo "\nURL-Rewriting with transparent session id support without output_add_rewrite_var()\n";
echo $testTags; echo $testTags;
--EXPECT-- --EXPECTF--
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 44
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 47
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 50
URL-Rewriting with transparent session id support without output_add_rewrite_var() URL-Rewriting with transparent session id support without output_add_rewrite_var()
<a href="?PHPSESSID=testid"></a> <a href="?PHPSESSID=testid"></a>

View file

@ -102,6 +102,9 @@ static zend_result php_ini_on_update_tags(zend_ini_entry *entry, zend_string *ne
static PHP_INI_MH(OnUpdateSessionTags) static PHP_INI_MH(OnUpdateSessionTags)
{ {
if (!zend_string_starts_with_literal(new_value, "a=href,area=href,frame=src,form=")) {
php_error_docref("session.configuration", E_DEPRECATED, "Usage of session.trans_sid_tags INI setting is deprecated");
}
return php_ini_on_update_tags(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage, /* is_session */ true); return php_ini_on_update_tags(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage, /* is_session */ true);
} }
@ -152,6 +155,9 @@ static zend_result php_ini_on_update_hosts(zend_ini_entry *entry, zend_string *n
static PHP_INI_MH(OnUpdateSessionHosts) static PHP_INI_MH(OnUpdateSessionHosts)
{ {
if (ZSTR_LEN(new_value) != 0) {
php_error_docref("session.configuration", E_DEPRECATED, "Usage of session.trans_sid_hosts INI setting is deprecated");
}
return php_ini_on_update_hosts(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage, /* is_session */ true); return php_ini_on_update_hosts(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage, /* is_session */ true);
} }