Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c5bce0d

Browse files
authoredAug 24, 2024··
Deprecate disabling use_only_cookies (#13578)
1 parent 9c26777 commit c5bce0d

39 files changed

+233
-25
lines changed
 

‎ext/session/session.c

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,40 @@ static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
846846
return SUCCESS;
847847
} /* }}} */
848848

849+
static PHP_INI_MH(OnUpdateUseOnlyCookies)
850+
{
851+
SESSION_CHECK_ACTIVE_STATE;
852+
SESSION_CHECK_OUTPUT_STATE;
853+
bool *p = (bool *) ZEND_INI_GET_ADDR();
854+
*p = zend_ini_parse_bool(new_value);
855+
if (!*p) {
856+
php_error_docref("session.configuration", E_DEPRECATED, "Disabling session.use_only_cookies INI setting is deprecated");
857+
}
858+
return SUCCESS;
859+
}
860+
861+
static PHP_INI_MH(OnUpdateUseTransSid)
862+
{
863+
SESSION_CHECK_ACTIVE_STATE;
864+
SESSION_CHECK_OUTPUT_STATE;
865+
bool *p = (bool *) ZEND_INI_GET_ADDR();
866+
*p = zend_ini_parse_bool(new_value);
867+
if (*p) {
868+
php_error_docref("session.configuration", E_DEPRECATED, "Enabling session.use_trans_sid INI setting is deprecated");
869+
}
870+
return SUCCESS;
871+
}
872+
873+
static PHP_INI_MH(OnUpdateRefererCheck)
874+
{
875+
SESSION_CHECK_ACTIVE_STATE;
876+
SESSION_CHECK_OUTPUT_STATE;
877+
if (ZSTR_LEN(new_value) != 0) {
878+
php_error_docref("session.configuration", E_DEPRECATED, "Usage of session.referer_check INI setting is deprecated");
879+
}
880+
return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
881+
}
882+
849883
/* {{{ PHP_INI */
850884
PHP_INI_BEGIN()
851885
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()
863897
STD_PHP_INI_BOOLEAN("session.cookie_httponly", "0", PHP_INI_ALL, OnUpdateSessionBool, cookie_httponly, php_ps_globals, ps_globals)
864898
STD_PHP_INI_ENTRY("session.cookie_samesite", "", PHP_INI_ALL, OnUpdateSessionString, cookie_samesite, php_ps_globals, ps_globals)
865899
STD_PHP_INI_BOOLEAN("session.use_cookies", "1", PHP_INI_ALL, OnUpdateSessionBool, use_cookies, php_ps_globals, ps_globals)
866-
STD_PHP_INI_BOOLEAN("session.use_only_cookies", "1", PHP_INI_ALL, OnUpdateSessionBool, use_only_cookies, php_ps_globals, ps_globals)
900+
STD_PHP_INI_BOOLEAN("session.use_only_cookies", "1", PHP_INI_ALL, OnUpdateUseOnlyCookies, use_only_cookies, php_ps_globals, ps_globals)
867901
STD_PHP_INI_BOOLEAN("session.use_strict_mode", "0", PHP_INI_ALL, OnUpdateSessionBool, use_strict_mode, php_ps_globals, ps_globals)
868-
STD_PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, OnUpdateSessionString, extern_referer_chk, php_ps_globals, ps_globals)
902+
STD_PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, OnUpdateRefererCheck, extern_referer_chk, php_ps_globals, ps_globals)
869903
STD_PHP_INI_ENTRY("session.cache_limiter", "nocache", PHP_INI_ALL, OnUpdateSessionString, cache_limiter, php_ps_globals, ps_globals)
870904
STD_PHP_INI_ENTRY("session.cache_expire", "180", PHP_INI_ALL, OnUpdateSessionLong, cache_expire, php_ps_globals, ps_globals)
871-
STD_PHP_INI_BOOLEAN("session.use_trans_sid", "0", PHP_INI_ALL, OnUpdateSessionBool, use_trans_sid, php_ps_globals, ps_globals)
905+
STD_PHP_INI_BOOLEAN("session.use_trans_sid", "0", PHP_INI_ALL, OnUpdateUseTransSid, use_trans_sid, php_ps_globals, ps_globals)
872906
PHP_INI_ENTRY("session.sid_length", "32", PHP_INI_ALL, OnUpdateSidLength)
873907
PHP_INI_ENTRY("session.sid_bits_per_character", "4", PHP_INI_ALL, OnUpdateSidBits)
874908
STD_PHP_INI_BOOLEAN("session.lazy_write", "1", PHP_INI_ALL, OnUpdateSessionBool, lazy_write, php_ps_globals, ps_globals)
@@ -1516,15 +1550,15 @@ PHPAPI zend_result php_session_reset_id(void) /* {{{ */
15161550
zval_ptr_dtor_str(sid);
15171551
ZVAL_STR(sid, smart_str_extract(&var));
15181552
} else {
1519-
REGISTER_STRINGL_CONSTANT("SID", ZSTR_VAL(var.s), ZSTR_LEN(var.s), 0);
1553+
REGISTER_STRINGL_CONSTANT("SID", ZSTR_VAL(var.s), ZSTR_LEN(var.s), CONST_DEPRECATED);
15201554
smart_str_free(&var);
15211555
}
15221556
} else {
15231557
if (sid) {
15241558
zval_ptr_dtor_str(sid);
15251559
ZVAL_EMPTY_STRING(sid);
15261560
} else {
1527-
REGISTER_STRINGL_CONSTANT("SID", "", 0, 0);
1561+
REGISTER_STRINGL_CONSTANT("SID", "", 0, CONST_DEPRECATED);
15281562
}
15291563
}
15301564

‎ext/session/tests/015.phpt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ error_reporting(E_ALL);
2020

2121
session_id("test015");
2222
session_start();
23+
$sid = SID;
2324
?>
24-
<a href="/link?<?php echo SID; ?>">
25+
<a href="/link?<?=$sid ?>">
2526
<?php
2627
session_destroy();
2728
?>
28-
--EXPECT--
29+
--EXPECTF--
30+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
31+
32+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
33+
34+
Deprecated: Constant SID is deprecated in %s on line 6
2935
<a href="/link?PHPSESSID=test015&PHPSESSID=test015">

‎ext/session/tests/018.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@ session_start();
2626
session_destroy();
2727
?>
2828
--EXPECT--
29+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
30+
31+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
2932
<form accept-charset="ISO-8859-15, ISO-8859-1" action=url.php><input type="hidden" name="PHPSESSID" value="test018" />

‎ext/session/tests/020.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ session_start();
2727
session_destroy();
2828
?>
2929
--EXPECT--
30+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
31+
32+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
3033
<a href="link.php?a=b&amp;PHPSESSID=test020">

‎ext/session/tests/021.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ ini_set("url_rewriter.tags", "a=href,fieldset=,area=href,frame=src,input=src");
5959

6060
session_destroy();
6161
?>
62-
--EXPECT--
62+
--EXPECTF--
63+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
64+
65+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
66+
67+
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 4
6368
<form action="//bad.net/do.php">
6469
<fieldset>
6570
<form action="//php.net/do.php"><input type="hidden" name="PHPSESSID" value="test021" />

‎ext/session/tests/bug36459.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ session_start();
3030
</body>
3131
</html>
3232
--EXPECTF--
33+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
34+
35+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
3336
<html>
3437
<head>
3538
<title>Bug #36459 Incorrect adding PHPSESSID to links, which contains \r\n</title>

‎ext/session/tests/bug41600.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ session_start();
2727
session_destroy();
2828
?>
2929
--EXPECT--
30+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
31+
32+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
3033
<a href="link.php?a=b&amp;PHPSESSID=bug41600">

‎ext/session/tests/bug42596.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ foreach (glob($sessdir. "*") as $sessfile) {
3434
rmdir($sessdir);
3535
?>
3636
--EXPECT--
37+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
3738
hello world
3839
string(6) "100777"

‎ext/session/tests/bug50308.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ session.use_only_cookies=0
2525
<a href=./>
2626
<a href="./">
2727
--EXPECTF--
28+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
29+
30+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
2831
<a href="?PHPSESSID=%s"/>
2932
<a href="?PHPSESSID=%s" />
3033
<a href="foo?PHPSESSID=%s"/>

‎ext/session/tests/bug51338.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ session_start();
1313
print_r(ob_list_handlers());
1414
?>
1515
--EXPECT--
16+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
1617
Array
1718
(
1819
)

‎ext/session/tests/bug71683.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ ob_start();
1414
echo "ok\n";
1515
?>
1616
--EXPECT--
17+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
1718
ok

‎ext/session/tests/bug71974.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ session
55
--SKIPIF--
66
<?php include('skipif.inc'); ?>
77
--INI--
8+
display_startup_errors=0
89
session.save_handler=files
910
session.auto_start=0
1011
session.use_cookies=1

‎ext/session/tests/bug72940.phpt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,15 @@ session_start();
3131
var_dump(session_id(), SID);
3232
session_destroy();
3333
?>
34-
--EXPECT--
34+
--EXPECTF--
35+
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 6
36+
37+
Deprecated: Constant SID is deprecated in %s on line 8
3538
string(12) "bug72940test"
3639
string(0) ""
40+
41+
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 13
42+
43+
Deprecated: Constant SID is deprecated in %s on line 15
3744
string(11) "bug72940get"
3845
string(21) "PHPSESSID=bug72940get"

‎ext/session/tests/bug74892.phpt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
--TEST--
22
Bug #74892 Url Rewriting (trans_sid) not working on urls that start with #
3+
--INI--
4+
session.use_cookies=0
5+
session.use_only_cookies=0
6+
session.use_trans_sid=1
37
--EXTENSIONS--
48
session
59
--SKIPIF--
610
<?php include('skipif.inc'); ?>
711
--FILE--
812
<?php
9-
ini_set('session.use_cookies', '0');
10-
ini_set('session.use_only_cookies',0);
11-
ini_set('session.use_trans_sid',1);
12-
ini_set('session.trans_sid_hosts','php.net');
13+
ob_start();
14+
ini_set('session.trans_sid_hosts','php.net'); // This value cannot be set in the INI file
1315
session_id('sessionidhere');
1416
session_start();
1517

@@ -18,7 +20,12 @@ session_start();
1820
<p><a href="index.php#place">External link with anchor</a></p>
1921
<p><a href="http://php.net#foo">External link with anchor 2</a></p>
2022
<p><a href="#place">Internal link</a></p>
21-
--EXPECT--
23+
--EXPECTF--
24+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
25+
26+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
27+
28+
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 3
2229
<p><a href="index.php?PHPSESSID=sessionidhere">Click This Anchor Tag!</a></p>
2330
<p><a href="index.php?PHPSESSID=sessionidhere#place">External link with anchor</a></p>
2431
<p><a href="http://php.net?PHPSESSID=sessionidhere#foo">External link with anchor 2</a></p>

‎ext/session/tests/deprecations.phpt

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
--TEST--
2+
Deprecated GET/POST sessions
3+
--EXTENSIONS--
4+
session
5+
--SKIPIF--
6+
<?php include 'skipif.inc'; ?>
7+
--INI--
8+
session.use_cookies=0
9+
session.use_only_cookies=1
10+
session.use_trans_sid=0
11+
--FILE--
12+
<?php
13+
14+
ob_start();
15+
16+
// Expecting deprecation here
17+
ini_set("session.use_only_cookies", "0");
18+
// Expecting no deprecation
19+
ini_set("session.use_only_cookies", "1");
20+
21+
// Expecting deprecation here
22+
ini_set("session.use_trans_sid", "1");
23+
// Expecting no deprecation
24+
ini_set("session.use_trans_sid", "0");
25+
26+
// Expecting deprecation here
27+
ini_set("session.trans_sid_tags", "a=href");
28+
// Expecting no deprecation (default value)
29+
ini_set("session.trans_sid_tags", "a=href,area=href,frame=src,form=");
30+
31+
// Expecting deprecation here
32+
ini_set("session.trans_sid_hosts", "php.net");
33+
// Expecting no deprecation (default value)
34+
ini_set("session.trans_sid_hosts", "");
35+
36+
// Expecting deprecation here
37+
ini_set("session.referer_check", "php.net");
38+
// Expecting no deprecation (default value)
39+
ini_set("session.referer_check", "");
40+
41+
// Setting deprecated values directly in session_start()
42+
// Expecting deprecation here
43+
session_start([ 'use_cookies' => '0', 'use_only_cookies' => '0', 'use_trans_sid' => '1']);
44+
45+
echo SID;
46+
47+
?>
48+
--EXPECTF--
49+
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 6
50+
51+
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 11
52+
53+
Deprecated: ini_set(): Usage of session.trans_sid_tags INI setting is deprecated in %s on line 16
54+
55+
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 21
56+
57+
Deprecated: ini_set(): Usage of session.referer_check INI setting is deprecated in %s on line 26
58+
59+
Deprecated: session_start(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 32
60+
61+
Deprecated: session_start(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 32
62+
63+
Deprecated: Constant SID is deprecated in %s on line 34
64+
PHPSESSID=%s

‎ext/session/tests/gh13891.phpt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,13 @@ session
1414
// We *must* set it here because the bug only triggers on a runtime edit
1515
ini_set('session.trans_sid_hosts','php.net');
1616
?>
17-
--EXPECT--
17+
--EXPECTF--
18+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
19+
20+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
21+
22+
Deprecated: PHP Startup: Usage of session.trans_sid_hosts INI setting is deprecated in Unknown on line 0
23+
24+
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 3
25+
26+
Deprecated: PHP Request Shutdown: Usage of session.trans_sid_hosts INI setting is deprecated in Unknown on line 0

‎ext/session/tests/rfc1867.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--TEST--
22
session rfc1867
33
--INI--
4+
display_startup_errors=0
45
file_uploads=1
56
upload_max_filesize=1024
67
session.save_path=

‎ext/session/tests/rfc1867_cleanup.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--TEST--
22
session rfc1867
33
--INI--
4+
display_startup_errors=0
45
file_uploads=1
56
upload_max_filesize=1024
67
session.save_path=

‎ext/session/tests/rfc1867_disabled.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--TEST--
22
session rfc1867 disabled
33
--INI--
4+
display_startup_errors=0
45
file_uploads=1
56
upload_max_filesize=1024
67
session.save_path=

‎ext/session/tests/rfc1867_disabled_2.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--TEST--
22
session rfc1867 disabled 2
33
--INI--
4+
display_startup_errors=0
45
file_uploads=1
56
upload_max_filesize=1024
67
session.save_path=

‎ext/session/tests/rfc1867_inter.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--TEST--
22
session rfc1867
33
--INI--
4+
display_startup_errors=0
45
file_uploads=1
56
upload_max_filesize=1024
67
session.save_path=

‎ext/session/tests/rfc1867_no_name.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--TEST--
22
session rfc1867 no name
33
--INI--
4+
display_startup_errors=0
45
file_uploads=1
56
upload_max_filesize=1024
67
session.save_path=

‎ext/session/tests/rfc1867_sid_cookie.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--TEST--
22
session rfc1867 sid cookie
33
--INI--
4+
display_startup_errors=0
45
file_uploads=1
56
upload_max_filesize=1024
67
session.save_path=

‎ext/session/tests/rfc1867_sid_get.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--TEST--
22
session rfc1867 sid get
33
--INI--
4+
display_startup_errors=0
45
file_uploads=1
56
upload_max_filesize=1024
67
session.save_path=

‎ext/session/tests/rfc1867_sid_get_2.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--TEST--
22
session rfc1867 sid get 2
33
--INI--
4+
display_startup_errors=0
45
file_uploads=1
56
upload_max_filesize=1024
67
session.save_path=

‎ext/session/tests/rfc1867_sid_invalid.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ upload_max_filesize=1024
66
session.save_path=
77
session.name=PHPSESSID
88
session.use_cookies=1
9-
session.use_only_cookies=0
109
session.use_strict_mode=0
1110
session.auto_start=0
1211
session.upload_progress.enabled=1

‎ext/session/tests/rfc1867_sid_post.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--TEST--
22
session rfc1867 sid post
33
--INI--
4+
display_startup_errors=0
45
file_uploads=1
56
upload_max_filesize=1024
67
session.save_path=

‎ext/session/tests/session_basic3.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ var_dump(session_destroy());
222222
ob_end_flush();
223223
?>
224224
--EXPECT--
225+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
226+
227+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
225228
*** Testing basic session functionality : variation3 use_trans_sid ***
226229
*** Test trans sid ***
227230

‎ext/session/tests/session_basic4.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ echo '
4848
';
4949
?>
5050
--EXPECT--
51+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
52+
53+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
5154
*** Testing basic session functionality : variation4 use_trans_sid ***
5255
*** Test trans sid ***
5356

‎ext/session/tests/session_basic5.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,12 @@ var_dump(session_destroy());
234234

235235
ob_end_flush();
236236
?>
237-
--EXPECT--
237+
--EXPECTF--
238+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
239+
240+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
241+
242+
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 5
238243
*** Testing basic session functionality : variation5 use_trans_sid ***
239244
*** Test trans sid ***
240245

‎ext/standard/tests/general_functions/bug44394_2.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ session
55
--INI--
66
session.name=PHPSESSID
77
session.use_only_cookies=0
8+
session.use_trans_sid=1
89
session.trans_sid_tags="a=href,area=href,frame=src,form="
910
url_rewriter.tags="a=href,area=href,frame=src,form="
1011
--FILE--
1112
<?php
1213

13-
ini_set('session.use_trans_sid', 1);
1414
session_save_path(__DIR__);
1515
session_start();
1616

@@ -34,4 +34,7 @@ foreach (glob(__DIR__ . '/sess_*') as $filename) {
3434
}
3535
?>
3636
--EXPECTF--
37+
Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
38+
39+
Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
3740
<a href='a?q=1&a=b&PHPSESSID=%s'>asd</a>

‎ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ Test use_trans_sid=1
7474
<form action="http://php.net/bar.php" method="get"> </form>
7575
<form action="bad://php.net/bar.php" method="get"> </form>
7676
<form action="//www.php.net/bar.php" method="get"> </form>
77-
--EXPECT--
77+
--EXPECTF--
78+
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 5
79+
80+
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 6
7881
Without session
7982
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
8083
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
@@ -105,6 +108,8 @@ Test use_trans_sid=0
105108
<form action="bad://php.net/bar.php" method="get"> </form>
106109
<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </form>
107110

111+
112+
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 50
108113
Test use_trans_sid=1
109114
<a href="?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a>
110115
<a href="./foo.php?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a>

‎ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ Test use_trans_sid=1
7474
<form action="http://php.net/bar.php" method="get"> </a>
7575
<form action="bad://php.net/bar.php" method="get"> </a>
7676
<form action="//www.php.net/bar.php" method="get"> </a>
77-
--EXPECT--
77+
--EXPECTF--
78+
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 5
7879
Without session
7980
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
8081
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
@@ -105,6 +106,8 @@ Test use_trans_sid=0
105106
<form action="bad://php.net/bar.php" method="get"> </a>
106107
<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
107108

109+
110+
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 50
108111
Test use_trans_sid=1
109112
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
110113
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>

‎ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ Test use_trans_sid=1
7373
<form action="http://php.net/bar.php" method="get"> </a>
7474
<form action="bad://php.net/bar.php" method="get"> </a>
7575
<form action="//www.php.net/bar.php" method="get"> </a>
76-
--EXPECT--
76+
--EXPECTF--
77+
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 5
7778
Without session
7879
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
7980
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
@@ -104,6 +105,8 @@ Test use_trans_sid=0
104105
<form action="bad://php.net/bar.php" method="get"> </a>
105106
<form action="//www.php.net/bar.php" method="get"> </a>
106107

108+
109+
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 49
107110
Test use_trans_sid=1
108111
<a href="?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a>
109112
<a href="./foo.php?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a>

‎ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Test use_trans_sid=1
7373
<form action="http://php.net/bar.php" method="get"> </a>
7474
<form action="bad://php.net/bar.php" method="get"> </a>
7575
<form action="//www.php.net/bar.php" method="get"> </a>
76-
--EXPECT--
76+
--EXPECTF--
7777
Without session
7878
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
7979
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
@@ -104,6 +104,8 @@ Test use_trans_sid=0
104104
<form action="bad://php.net/bar.php" method="get"> </a>
105105
<form action="//www.php.net/bar.php" method="get"> </a>
106106

107+
108+
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 49
107109
Test use_trans_sid=1
108110
<a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
109111
<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>

‎ext/standard/tests/general_functions/url_rewriting_basic1.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ session_start();
7676
echo "\nURL-Rewriting with transparent session id support without output_add_rewrite_var()\n";
7777
echo $testTags;
7878

79-
--EXPECT--
79+
--EXPECTF--
80+
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 44
8081
URL-Rewriting with output_add_rewrite_var() without transparent session id support
8182

8283
<a href="?%3Cname%3E=%3Cvalue%3E"></a>
@@ -115,6 +116,10 @@ URL-Rewriting with output_add_rewrite_var() without transparent session id suppo
115116
<form action="bad://url-rewriter.com/bar.php" method="get"></form>
116117
<form action="//www.url-rewriter.com/bar.php" method="get"></form>
117118

119+
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 60
120+
121+
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 63
122+
118123
URL-Rewriting with transparent session id support without output_add_rewrite_var()
119124

120125
<a href="?PHPSESSID=testid"></a>

‎ext/standard/tests/general_functions/url_rewriting_basic2.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ output_add_rewrite_var('<name2>', '<value2>');
8787
echo "\nURL-Rewriting with output_add_rewrite_var() without transparent session id support\n";
8888
echo $testTags;
8989

90-
--EXPECT--
90+
--EXPECTF--
91+
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 44
9192
URL-Rewriting with output_add_rewrite_var() without transparent session id support
9293

9394
<a href="?%3Cname%3E=%3Cvalue%3E"></a>
@@ -126,6 +127,10 @@ URL-Rewriting with output_add_rewrite_var() without transparent session id suppo
126127
<form action="bad://url-rewriter.com/bar.php" method="get"></form>
127128
<form action="//www.url-rewriter.com/bar.php" method="get"></form>
128129

130+
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 61
131+
132+
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 64
133+
129134
URL-Rewriting with transparent session id support without output_add_rewrite_var()
130135

131136
<a href="?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E&%3Cname2%3E=%3Cvalue2%3E"></a>

‎ext/standard/tests/general_functions/url_rewriting_basic3.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ output_add_rewrite_var('<name2>', '<value2>');
8080
echo "\nURL-Rewriting with transparent session id support without output_add_rewrite_var()\n";
8181
echo $testTags;
8282

83-
--EXPECT--
83+
--EXPECTF--
84+
Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 44
85+
86+
Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 47
87+
88+
Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 50
8489
URL-Rewriting with transparent session id support without output_add_rewrite_var()
8590

8691
<a href="?PHPSESSID=testid"></a>

‎ext/standard/url_scanner_ex.re

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ static zend_result php_ini_on_update_tags(zend_ini_entry *entry, zend_string *ne
102102

103103
static PHP_INI_MH(OnUpdateSessionTags)
104104
{
105+
if (!zend_string_starts_with_literal(new_value, "a=href,area=href,frame=src,form=")) {
106+
php_error_docref("session.configuration", E_DEPRECATED, "Usage of session.trans_sid_tags INI setting is deprecated");
107+
}
105108
return php_ini_on_update_tags(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage, /* is_session */ true);
106109
}
107110

@@ -152,6 +155,9 @@ static zend_result php_ini_on_update_hosts(zend_ini_entry *entry, zend_string *n
152155

153156
static PHP_INI_MH(OnUpdateSessionHosts)
154157
{
158+
if (ZSTR_LEN(new_value) != 0) {
159+
php_error_docref("session.configuration", E_DEPRECATED, "Usage of session.trans_sid_hosts INI setting is deprecated");
160+
}
155161
return php_ini_on_update_hosts(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage, /* is_session */ true);
156162
}
157163

0 commit comments

Comments
 (0)
Please sign in to comment.