Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ext/session/mod_user_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@

#include "php.h"
#include "php_session.h"
#include "mod_user.h"

#define PS_SANITY_CHECK \
if (PS(session_status) != php_session_active) { \
zend_throw_error(NULL, "Session is not active"); \
RETURN_THROWS(); \
} \
if (PS(default_mod) == NULL) { \
if (PS(default_mod) == NULL || PS(default_mod) == ps_user_ptr) { \
zend_throw_error(NULL, "Cannot call default session handler"); \
RETURN_THROWS(); \
}
Expand Down
24 changes: 24 additions & 0 deletions ext/session/tests/user_session_module/gh25307.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
GH-25307 (NULL ps_files dereference in ps_files_close at shutdown)
--EXTENSIONS--
session
--SKIPIF--
<?php include(__DIR__ . '/../skipif.inc'); ?>
--CREDITS--
YuanchengJiang
--FILE--
<?php
ob_start();
session_set_save_handler(new SessionHandler(), true);
ini_set("session.save_handler", "files");
session_start();
try {
(new SessionHandler)->open("", "");
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
echo "Done\n";
?>
--EXPECT--
Cannot call default session handler
Done
Loading