Skip to content

Commit 0dc5998

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Fix GH-13856: Member access within null pointer of type 'ps_files' in ext/session/mod_files.c
2 parents 17f936e + 3f598a3 commit 0dc5998

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

ext/session/mod_user_class.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,17 @@ PHP_METHOD(SessionHandler, open)
4747

4848
PS_SANITY_CHECK;
4949

50-
PS(mod_user_is_open) = 1;
51-
5250
zend_try {
5351
ret = PS(default_mod)->s_open(&PS(mod_data), save_path, session_name);
5452
} zend_catch {
5553
PS(session_status) = php_session_none;
5654
zend_bailout();
5755
} zend_end_try();
5856

57+
if (SUCCESS == ret) {
58+
PS(mod_user_is_open) = 1;
59+
}
60+
5961
RETURN_BOOL(SUCCESS == ret);
6062
}
6163
/* }}} */

ext/session/tests/gh13856.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
GH-13856 (Member access within null pointer of type 'ps_files' in ext/session/mod_files.c)
3+
--EXTENSIONS--
4+
session
5+
--INI--
6+
session.save_handler=files
7+
open_basedir=.
8+
error_reporting=E_ALL
9+
--FILE--
10+
<?php
11+
session_set_save_handler(new \SessionHandler(), true);
12+
session_start();
13+
?>
14+
--EXPECTF--
15+
Warning: SessionHandler::open(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line %d
16+
17+
Warning: SessionHandler::close(): Parent session handler is not open in %s on line %d
18+
19+
Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d

0 commit comments

Comments
 (0)