[php-src] master: Merge branch 'PHP-8.3'
| From: | Niels Dossche | Date: | Mon, 01 Apr 2024 12:16:34 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.3' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-127924@lists.php.net to get a copy of this message | ||
Author: Niels Dossche (nielsdos)
Date: 2024-04-01T14:16:28+02:00
Commit: https://github.com/php/php-src/commit/0dc599853aeffe5e6e843cafed5c2a3dfdd6e820
Raw diff: https://github.com/php/php-src/commit/0dc599853aeffe5e6e843cafed5c2a3dfdd6e820.diff
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
Changed paths:
A ext/session/tests/gh13856.phpt
M ext/session/mod_user_class.c
Diff:
diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c
index d5b71da52c28..853db659887b 100644
--- a/ext/session/mod_user_class.c
+++ b/ext/session/mod_user_class.c
@@ -47,8 +47,6 @@ 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 {
@@ -56,6 +54,10 @@ PHP_METHOD(SessionHandler, open)
zend_bailout();
} zend_end_try();
+ if (SUCCESS == ret) {
+ PS(mod_user_is_open) = 1;
+ }
+
RETURN_BOOL(SUCCESS == ret);
}
/* }}} */
diff --git a/ext/session/tests/gh13856.phpt b/ext/session/tests/gh13856.phpt
new file mode 100644
index 000000000000..a6d9fa0eaedb
--- /dev/null
+++ b/ext/session/tests/gh13856.phpt
@@ -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