diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 87bcb7e3690fc..072fed351dbff 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -451,7 +451,7 @@ PS_CLOSE_FUNC(files) zend_string_release_ex(data->basedir, /* persistent */ false); efree(data); - PS_SET_MOD_DATA(NULL); + PS_SET_MOD_DATA(data); return SUCCESS; } diff --git a/ext/session/tests/sessionhandler_validateid_return_type.phpt b/ext/session/tests/sessionhandler_validateid_return_type.phpt new file mode 100644 index 0000000000000..a100694588206 --- /dev/null +++ b/ext/session/tests/sessionhandler_validateid_return_type.phpt @@ -0,0 +1,35 @@ +--TEST-- +SessionHandler::validateId must return bool +--INI-- +session.use_strict_mode=1 +--EXTENSIONS-- +session +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +session_write_close(); + +try { + session_start(); +} catch (Throwable $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECTF-- +Session id must be a string