mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.4'
* PHP-8.4: Fix type confusion with session SID constant
This commit is contained in:
commit
6d4598eba8
2 changed files with 21 additions and 2 deletions
|
@ -1571,7 +1571,7 @@ PHPAPI zend_result php_session_reset_id(void) /* {{{ */
|
|||
smart_str_appends(&var, ZSTR_VAL(PS(id)));
|
||||
smart_str_0(&var);
|
||||
if (sid) {
|
||||
zval_ptr_dtor_str(sid);
|
||||
zval_ptr_dtor(sid);
|
||||
ZVAL_STR(sid, smart_str_extract(&var));
|
||||
} else {
|
||||
REGISTER_STRINGL_CONSTANT("SID", ZSTR_VAL(var.s), ZSTR_LEN(var.s), CONST_DEPRECATED);
|
||||
|
@ -1579,7 +1579,7 @@ PHPAPI zend_result php_session_reset_id(void) /* {{{ */
|
|||
}
|
||||
} else {
|
||||
if (sid) {
|
||||
zval_ptr_dtor_str(sid);
|
||||
zval_ptr_dtor(sid);
|
||||
ZVAL_EMPTY_STRING(sid);
|
||||
} else {
|
||||
REGISTER_STRINGL_CONSTANT("SID", "", 0, CONST_DEPRECATED);
|
||||
|
|
19
ext/session/tests/SID_type_confusion.phpt
Normal file
19
ext/session/tests/SID_type_confusion.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
SID constant type confusion
|
||||
--EXTENSIONS--
|
||||
session
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
session.use_cookies=0
|
||||
session.use_only_cookies=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
define('SID', [0xdeadbeef]);
|
||||
session_start();
|
||||
var_dump(SID);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
Loading…
Add table
Add a link
Reference in a new issue