Merge branch 'PHP-8.1' into PHP-8.2

* PHP-8.1:
  Remove session ID set through REQUEST_URI
This commit is contained in:
Ilija Tovilo 2023-06-22 12:36:52 +02:00
commit 1441f30a8d
No known key found for this signature in database
GPG key ID: A4F5D403F118200A
2 changed files with 4 additions and 16 deletions

3
NEWS
View file

@ -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.2.8
- CLI:

View file

@ -1489,7 +1489,7 @@ PHPAPI zend_result php_session_start(void) /* {{{ */
{
zval *ppid;
zval *data;
char *p, *value;
char *value;
size_t lensess;
switch (PS(session_status)) {
@ -1558,21 +1558,6 @@ PHPAPI zend_result 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' &&