Skip to content

Commit

Permalink
Merge branch 'PHP-8.3'
Browse files Browse the repository at this point in the history
* PHP-8.3:
  Fix GH-13856: Member access within null pointer of type 'ps_files' in ext/session/mod_files.c
  • Loading branch information
nielsdos committed Apr 1, 2024
2 parents 17f936e + 3f598a3 commit 0dc5998
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
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

0 comments on commit 0dc5998

Please sign in to comment.