diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2021-03-19 14:47:49 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2021-03-19 16:59:54 +0100 |
commit | 06bfada99bcff9bd2e3a5e959effa2237c07939b (patch) | |
tree | bf7b164409fa4230c2ca954432c6206dbfc56626 /ext/session/tests | |
parent | bccca0b53aa60a62e2988c750fc73c02d109e642 (diff) | |
download | php-git-06bfada99bcff9bd2e3a5e959effa2237c07939b.tar.gz |
Fix #80889: Cannot set save handler when save_handler is invalid
There is no need to require a (valid) save_handler to be set, when a
user handler is supposed to be set. We just have to make sure, that
no user handler is already set in this case.
Closes GH-6788.
Diffstat (limited to 'ext/session/tests')
-rw-r--r-- | ext/session/tests/bug80889.phpt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ext/session/tests/bug80889.phpt b/ext/session/tests/bug80889.phpt new file mode 100644 index 0000000000..78e1a6ab64 --- /dev/null +++ b/ext/session/tests/bug80889.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #80889 (Cannot set save handler when save_handler is invalid) +--SKIPIF-- +<?php include('skipif.inc'); ?> +--INI-- +session.save_handler=whatever +--FILE-- +<?php +class DummyHandler implements SessionHandlerInterface { + public function open($savePath, $sessionName) { + return true; + } + public function close() { + return true; + } + public function read($id) { + return ''; + } + public function write($id, $data) { + return true; + } + public function destroy($id) { + return true; + } + public function gc($maxlifetime) { + return true; + } +} + +$initHandler = ini_get('session.save_handler'); +session_set_save_handler(new DummyHandler()); +$setHandler = ini_get('session.save_handler'); +var_dump($initHandler, $setHandler); +?> +--EXPECT-- +string(8) "whatever" +string(4) "user" |