1212 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
1313 * @package SessionHandler
1414 */
15- class Horde_SessionHandler
15+ class Horde_SessionHandler implements SessionHandlerInterface
1616{
17+ /**
18+ * The session data.
19+ *
20+ * @var string
21+ */
22+ public $ data = '' ;
23+
24+ /**
25+ * The session identifier.
26+ *
27+ * @var string
28+ */
29+ public $ id = '' ;
30+
31+ /**
32+ * The session name.
33+ *
34+ * @var string
35+ */
36+ public $ name = '' ;
37+
1738 /**
1839 * If true, indicates the session data has changed.
1940 *
@@ -92,14 +113,7 @@ public function __construct(Horde_SessionHandler_Storage $storage,
92113 $ this ->_storage = $ storage ;
93114
94115 if (empty ($ this ->_params ['noset ' ])) {
95- session_set_save_handler (
96- array ($ this , 'open ' ),
97- array ($ this , 'close ' ),
98- array ($ this , 'read ' ),
99- array ($ this , 'write ' ),
100- array ($ this , 'destroy ' ),
101- array ($ this , 'gc ' )
102- );
116+ session_set_save_handler ($ this );
103117 }
104118 }
105119
@@ -122,7 +136,7 @@ public function __destruct()
122136 *
123137 * @return boolean True on success, false otherwise.
124138 */
125- public function open ($ save_path = null , $ session_name = null )
139+ public function open ($ save_path = null , $ session_name = null ): bool
126140 {
127141 if (!$ this ->_connected ) {
128142 try {
@@ -143,7 +157,7 @@ public function open($save_path = null, $session_name = null)
143157 *
144158 * @return boolean True on success, false otherwise.
145159 */
146- public function close ()
160+ public function close (): bool
147161 {
148162 try {
149163 $ this ->_storage ->close ();
@@ -164,7 +178,7 @@ public function close()
164178 *
165179 * @return string The session data.
166180 */
167- public function read ($ id )
181+ public function read ($ id ): string | false
168182 {
169183 if (($ result = $ this ->_storage ->read ($ id )) == '' ) {
170184 $ this ->_logger ->log ('Error retrieving session data ( ' . $ id . ') ' , 'DEBUG ' );
@@ -189,7 +203,7 @@ public function read($id)
189203 *
190204 * @return boolean True on success, false otherwise.
191205 */
192- public function write ($ id , $ session_data )
206+ public function write ($ id , $ session_data ): bool
193207 {
194208 if ($ this ->changed ||
195209 (empty ($ this ->_params ['no_md5 ' ]) &&
@@ -213,7 +227,7 @@ public function write($id, $session_data)
213227 *
214228 * @return boolean True on success, false otherwise.
215229 */
216- public function destroy ($ id )
230+ public function destroy ($ id ): bool
217231 {
218232 if ($ this ->_storage ->destroy ($ id )) {
219233 $ this ->_logger ->log ('Session data destroyed ( ' . $ id . ') ' , 'DEBUG ' );
@@ -233,7 +247,7 @@ public function destroy($id)
233247 *
234248 * @return boolean True on success, false otherwise.
235249 */
236- public function gc ($ maxlifetime = 300 )
250+ public function gc ($ maxlifetime = 300 ): int | false
237251 {
238252 return $ this ->_storage ->gc ($ maxlifetime );
239253 }
0 commit comments