Skip to content

Fix GH-13856: Member access within null pointer of type 'ps_files' in ext/session/mod_files.c #13858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 4 additions & 2 deletions ext/session/mod_user_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ PHP_METHOD(SessionHandler, open)

PS_SANITY_CHECK;

PS(mod_user_is_open) = 1;

zend_try {
ret = PS(default_mod)->s_open(&PS(mod_data), save_path, session_name);
} zend_catch {
PS(session_status) = php_session_none;
zend_bailout();
} zend_end_try();

if (SUCCESS == ret) {
PS(mod_user_is_open) = 1;
}

RETURN_BOOL(SUCCESS == ret);
}
/* }}} */
Expand Down
19 changes: 19 additions & 0 deletions ext/session/tests/gh13856.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
GH-13856 (Member access within null pointer of type 'ps_files' in ext/session/mod_files.c)
--EXTENSIONS--
session
--INI--
session.save_handler=files
open_basedir=.
error_reporting=E_ALL
--FILE--
<?php
session_set_save_handler(new \SessionHandler(), true);
session_start();
?>
--EXPECTF--
Warning: SessionHandler::open(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line %d

Warning: SessionHandler::close(): Parent session handler is not open in %s on line %d

Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d