diff options
Diffstat (limited to 'tests/session/session_recursive_crash2.phpt')
| -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..2a32226 --- /dev/null +++ b/tests/session/session_recursive_crash2.phpt | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | --TEST-- | ||
| 2 | session user handler recursive crash - issue suhosin#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() {return TRUE;} | ||
| 23 | public function destroy($session_id) {return TRUE;} | ||
| 24 | public function gc($maxlifetime) {return TRUE;} | ||
| 25 | public function open($save_path, $name) { global $foo; $foo .= "A\n"; return TRUE;} | ||
| 26 | public function read($session_id ) {return TRUE;} | ||
| 27 | public function write($session_id, $session_data) {return TRUE;} | ||
| 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"; return TRUE;} | ||
| 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"; return TRUE;} | ||
| 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 | ||
