@@ -22,7 +22,7 @@ public function __construct($dao) {
2222 * @param string $name
2323 * @return bool
2424 */
25- public function open ($ save_path , $ name ) {
25+ public function open ($ save_path , $ name ): bool {
2626 return TRUE ;
2727 }
2828
@@ -32,7 +32,7 @@ public function open($save_path, $name) {
3232 * @param string $session_id
3333 * @return string
3434 */
35- public function read ($ session_id ) {
35+ public function read ($ session_id ): string | false {
3636 $ this ->session = $ this ->dao ->get ($ session_id );
3737 if (!$ this ->session ) $ this ->createFreshSession ($ session_id );
3838 return $ this ->session ->data ;
@@ -66,19 +66,19 @@ protected function createFreshSession($session_id) {
6666 * @param string $data
6767 * @return bool
6868 */
69- public function write ($ session_id , $ data ) {
69+ public function write ($ session_id , $ data ): bool {
7070
7171 // In case there is no object yet
7272 if ($ this ->session == NULL ) $ this ->createFreshSession ($ session_id );
7373
7474 // Update fields
7575 $ now = new Date (time (), WFW_TIMEZONE );
76- $ expiryTime = $ _SESSION ['persistent ' ] ? 365 *24 *3600 : ini_get ('session.gc_maxlifetime ' );
76+ $ expiryTime = isset ( $ _SESSION [ ' persistent ' ]) && $ _SESSION ['persistent ' ] ? 365 *24 *3600 : ini_get ('session.gc_maxlifetime ' );
7777 $ expiry = new Date (time ()+$ expiryTime , WFW_TIMEZONE );
7878 $ this ->session ->update_time = $ now ->toMysql (TRUE );
7979 $ this ->session ->expiry_time = $ expiry ->toMysql (TRUE );
8080 $ this ->session ->data = $ data ;
81- $ this ->session ->persistent = $ _SESSION ['persistent ' ] ? 1 : 0 ;
81+ $ this ->session ->persistent = isset ( $ _SESSION [ ' persistent ' ]) && $ _SESSION ['persistent ' ] ? 1 : 0 ;
8282
8383 // Persist
8484 $ session = $ this ->dao ->get ($ session_id );
@@ -101,7 +101,7 @@ public function write($session_id, $data) {
101101 *
102102 * @return bool
103103 */
104- public function close () {
104+ public function close (): bool {
105105 if ($ this ->session ) {
106106 return $ this ->gc (ini_get ('session.gc_maxlifetime ' ));
107107 }
@@ -114,7 +114,7 @@ public function close() {
114114 * @param int $session_id
115115 * @return bool
116116 */
117- public function destroy ($ session_id ) {
117+ public function destroy ($ session_id ): bool {
118118 $ this ->createFreshSession ($ session_id );
119119 $ this ->dao ->delete ($ this ->session );
120120 return TRUE ;
@@ -126,7 +126,7 @@ public function destroy($session_id) {
126126 * @param int $maxlifetime
127127 * @return bool
128128 */
129- public function gc ($ maxlifetime ) {
129+ public function gc ($ maxlifetime ): int | false {
130130 // As we had the expiry set explicitely, we dont need the max lifetime
131131 $ expired = $ this ->dao ->expire ($ maxlifetime );
132132 return TRUE ;
0 commit comments