Skip to content

Commit f160eff

Browse files
committed
Remove session ID set through REQUEST_URI
1 parent 466fc78 commit f160eff

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ PHP NEWS
55
- PCRE:
66
. Mangle PCRE regex cache key with JIT option. (mvorisek)
77

8+
- Session:
9+
. Removed broken url support for transferring session ID. (ilutov)
10+
811
06 Jul 2023, PHP 8.1.21
912

1013
- CLI:

ext/session/session.c

+1-16
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ PHPAPI int php_session_start(void) /* {{{ */
15031503
{
15041504
zval *ppid;
15051505
zval *data;
1506-
char *p, *value;
1506+
char *value;
15071507
size_t lensess;
15081508

15091509
switch (PS(session_status)) {
@@ -1572,21 +1572,6 @@ PHPAPI int php_session_start(void) /* {{{ */
15721572
ppid2sid(ppid);
15731573
}
15741574
}
1575-
/* Check the REQUEST_URI symbol for a string of the form
1576-
* '<session-name>=<session-id>' to allow URLs of the form
1577-
* http://yoursite/<session-name>=<session-id>/script.php */
1578-
if (!PS(id) && zend_is_auto_global(ZSTR_KNOWN(ZEND_STR_AUTOGLOBAL_SERVER)) == SUCCESS &&
1579-
(data = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "REQUEST_URI", sizeof("REQUEST_URI") - 1)) &&
1580-
Z_TYPE_P(data) == IS_STRING &&
1581-
(p = strstr(Z_STRVAL_P(data), PS(session_name))) &&
1582-
p[lensess] == '='
1583-
) {
1584-
char *q;
1585-
p += lensess + 1;
1586-
if ((q = strpbrk(p, "/?\\"))) {
1587-
PS(id) = zend_string_init(p, q - p, 0);
1588-
}
1589-
}
15901575
/* Check whether the current request was referred to by
15911576
* an external site which invalidates the previously found id. */
15921577
if (PS(id) && PS(extern_referer_chk)[0] != '\0' &&

0 commit comments

Comments
 (0)