Skip to content

Commit 6d4598e

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix type confusion with session SID constant
2 parents ad4cbf4 + b448d54 commit 6d4598e

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

ext/session/session.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,15 +1571,15 @@ PHPAPI zend_result php_session_reset_id(void) /* {{{ */
15711571
smart_str_appends(&var, ZSTR_VAL(PS(id)));
15721572
smart_str_0(&var);
15731573
if (sid) {
1574-
zval_ptr_dtor_str(sid);
1574+
zval_ptr_dtor(sid);
15751575
ZVAL_STR(sid, smart_str_extract(&var));
15761576
} else {
15771577
REGISTER_STRINGL_CONSTANT("SID", ZSTR_VAL(var.s), ZSTR_LEN(var.s), CONST_DEPRECATED);
15781578
smart_str_free(&var);
15791579
}
15801580
} else {
15811581
if (sid) {
1582-
zval_ptr_dtor_str(sid);
1582+
zval_ptr_dtor(sid);
15831583
ZVAL_EMPTY_STRING(sid);
15841584
} else {
15851585
REGISTER_STRINGL_CONSTANT("SID", "", 0, CONST_DEPRECATED);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
SID constant type confusion
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+
--FILE--
11+
<?php
12+
13+
define('SID', [0xdeadbeef]);
14+
session_start();
15+
var_dump(SID);
16+
17+
?>
18+
--EXPECT--
19+
string(0) ""

0 commit comments

Comments
 (0)