@@ -13,7 +13,7 @@ session.serialize_handler=php
1313error_reporting (E_ALL );
1414ob_start ();
1515
16- class handler {
16+ class handler implements SessionHandlerInterface {
1717 public $ data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}} ' ;
1818 function open ($ save_path , $ session_name ): bool
1919 {
@@ -44,7 +44,7 @@ class handler {
4444 return true ;
4545 }
4646
47- function gc () { return true ; }
47+ function gc ($ max_lifetime ): int { return 1 ; }
4848}
4949
5050$ hnd = new handler ;
@@ -55,7 +55,7 @@ class foo {
5555 function method () { $ this ->yes ++; }
5656}
5757
58- session_set_save_handler (array ( $ hnd, " open " ), array ( $ hnd , " close " ), array ( $ hnd , " read " ), array ( $ hnd , " write " ), array ( $ hnd , " destroy " ), array ( $ hnd , " gc " ) );
58+ session_set_save_handler ($ hnd );
5959
6060session_id ("test005 " );
6161session_start ();
@@ -69,7 +69,7 @@ var_dump($_SESSION["arr"]);
6969
7070session_write_close ();
7171
72- session_set_save_handler (array ( $ hnd, " open " ), array ( $ hnd , " close " ), array ( $ hnd , " read " ), array ( $ hnd , " write " ), array ( $ hnd , " destroy " ), array ( $ hnd , " gc " ) );
72+ session_set_save_handler ($ hnd );
7373session_start ();
7474$ _SESSION ["baz " ]->method ();
7575$ _SESSION ["arr " ][3 ]->method ();
@@ -82,7 +82,7 @@ var_dump($_SESSION["c"]);
8282
8383session_write_close ();
8484
85- session_set_save_handler (array ( $ hnd, " open " ), array ( $ hnd , " close " ), array ( $ hnd , " read " ), array ( $ hnd , " write " ), array ( $ hnd , " destroy " ), array ( $ hnd , " gc " ) );
85+ session_set_save_handler ($ hnd );
8686session_start ();
8787var_dump ($ _SESSION ["baz " ]);
8888var_dump ($ _SESSION ["arr " ]);
0 commit comments