Skip to content

Commit

Permalink
Remove session ID set through REQUEST_URI
Browse files Browse the repository at this point in the history
  • Loading branch information
iluuu1994 committed Jun 22, 2023
1 parent 466fc78 commit f160eff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
3 changes: 3 additions & 0 deletions NEWS
Expand Up @@ -5,6 +5,9 @@ PHP NEWS
- PCRE:
. Mangle PCRE regex cache key with JIT option. (mvorisek)

- Session:
. Removed broken url support for transferring session ID. (ilutov)

06 Jul 2023, PHP 8.1.21

- CLI:
Expand Down
17 changes: 1 addition & 16 deletions ext/session/session.c
Expand Up @@ -1503,7 +1503,7 @@ PHPAPI int php_session_start(void) /* {{{ */
{
zval *ppid;
zval *data;
char *p, *value;
char *value;
size_t lensess;

switch (PS(session_status)) {
Expand Down Expand Up @@ -1572,21 +1572,6 @@ PHPAPI int php_session_start(void) /* {{{ */
ppid2sid(ppid);
}
}
/* Check the REQUEST_URI symbol for a string of the form
* '<session-name>=<session-id>' to allow URLs of the form
* http://yoursite/<session-name>=<session-id>/script.php */
if (!PS(id) && zend_is_auto_global(ZSTR_KNOWN(ZEND_STR_AUTOGLOBAL_SERVER)) == SUCCESS &&
(data = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "REQUEST_URI", sizeof("REQUEST_URI") - 1)) &&
Z_TYPE_P(data) == IS_STRING &&
(p = strstr(Z_STRVAL_P(data), PS(session_name))) &&
p[lensess] == '='
) {
char *q;
p += lensess + 1;
if ((q = strpbrk(p, "/?\\"))) {
PS(id) = zend_string_init(p, q - p, 0);
}
}
/* Check whether the current request was referred to by
* an external site which invalidates the previously found id. */
if (PS(id) && PS(extern_referer_chk)[0] != '\0' &&
Expand Down

0 comments on commit f160eff

Please sign in to comment.