[php-src] Issue #21193: Previous `create_sid` handler remains active when not explicitly overridden
[email protected] (TimWolla)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/21193
Author: TimWolla
### Description
The following code:
```php
<?php
ob_start();
session_set_save_handler(
function ($savePath, $sessionName) {
var_dump("open");
return true;
},
function () {
var_dump("close");
return true;
},
function ($id) {
var_dump("read");
return '';
},
function ($id, $data) {
var_dump("write");
return true;
},
function ($id) {
var_dump("destroy");
return true;
},
function ($maxlifetime) {
var_dump("gc");
return true;
},
function () {
var_dump("create_sid");
return 'foo';
}
);
session_set_save_handler(
function ($savePath, $sessionName) {
var_dump("open");
return true;
},
function () {
var_dump("close");
return true;
},
function ($id) {
var_dump("read");
return '';
},
function ($id, $data) {
var_dump("write");
return true;
},
function ($id) {
var_dump("destroy");
return true;
},
function ($maxlifetime) {
var_dump("gc");
return true;
},
);
session_start();
```
Resulted in this output:
```
string(4) "open"
string(10) "create_sid"
string(4) "read"
string(5) "write"
string(5) "close"
```
But I expected this output instead:
```
string(4) "open"
string(4) "read"
string(5) "write"
string(5) "close"
```
### PHP Version
```plain
PHP 8.4.17 (cli) (built: Jan 18 2026 14:19:44) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.17, Copyright (c) Zend Technologies
with Zend OPcache v8.4.17, Copyright (c), by Zend Technologies
```
### Operating System
_No response_