diff options
| author | Ben Fuhrmannek | 2014-11-12 13:46:38 +0100 |
|---|---|---|
| committer | Ben Fuhrmannek | 2014-11-12 13:46:38 +0100 |
| commit | 17849bcb55f757e6271c7d3e21ab34ccec849e07 (patch) | |
| tree | c4e03b3c233a74cdd02348f3dfdd024ac777f943 /tests/session | |
| parent | d618c47b3e8945484c7e202f5dfbf2669870f16d (diff) | |
fixed session recursion - issue #60
Diffstat (limited to 'tests/session')
| -rw-r--r-- | tests/session/session_recursive_crash2.phpt | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/session/session_recursive_crash2.phpt b/tests/session/session_recursive_crash2.phpt new file mode 100644 index 0000000..e99d924 --- /dev/null +++ b/tests/session/session_recursive_crash2.phpt | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | --TEST-- | ||
| 2 | session user handler recursive crash - issue #60 | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php include "../skipifcli.inc"; ?> | ||
| 5 | --ENV-- | ||
| 6 | return <<<END | ||
| 7 | HTTP_USER_AGENT=test | ||
| 8 | END; | ||
| 9 | --INI-- | ||
| 10 | suhosin.session.encrypt=On | ||
| 11 | suhosin.session.cryptkey=D3F4UL7 | ||
| 12 | suhosin.session.cryptua=On | ||
| 13 | suhosin.session.cryptdocroot=Off | ||
| 14 | suhosin.session.cryptraddr=0 | ||
| 15 | suhosin.session.checkraddr=0 | ||
| 16 | --FILE-- | ||
| 17 | <?php | ||
| 18 | $foo = ""; | ||
| 19 | |||
| 20 | class MySessionHandlerA implements SessionHandlerInterface | ||
| 21 | { | ||
| 22 | public function close() {} | ||
| 23 | public function destroy($session_id) {} | ||
| 24 | public function gc($maxlifetime) {} | ||
| 25 | public function open($save_path, $name) { global $foo; $foo .= "A\n"; } | ||
| 26 | public function read($session_id ) {} | ||
| 27 | public function write($session_id, $session_data) {} | ||
| 28 | } | ||
| 29 | |||
| 30 | session_set_save_handler(new MySessionHandlerA(), true); | ||
| 31 | session_start(); | ||
| 32 | session_destroy(); | ||
| 33 | |||
| 34 | // | ||
| 35 | |||
| 36 | class MySessionHandlerB extends MySessionHandlerA | ||
| 37 | { | ||
| 38 | public function open($save_path, $name) { global $foo; $foo .= "B\n"; } | ||
| 39 | } | ||
| 40 | |||
| 41 | session_set_save_handler(new MySessionHandlerB(), true); | ||
| 42 | session_start(); | ||
| 43 | session_destroy(); | ||
| 44 | |||
| 45 | // | ||
| 46 | |||
| 47 | class MySessionHandlerC extends MySessionHandlerA | ||
| 48 | { | ||
| 49 | public function open($save_path, $name) { global $foo; $foo .= "C\n"; } | ||
| 50 | } | ||
| 51 | |||
| 52 | session_set_save_handler(new MySessionHandlerC(), true); | ||
| 53 | session_start(); | ||
| 54 | session_destroy(); | ||
| 55 | |||
| 56 | |||
| 57 | echo $foo; | ||
| 58 | --EXPECTF-- | ||
| 59 | A | ||
| 60 | B | ||
| 61 | C | ||
