Skip to content
This repository was archived by the owner on Nov 18, 2025. It is now read-only.

Commit bef9208

Browse files
committed
🐛 fix to support session in PHP 8.1
Signed-off-by: otengkwame <[email protected]>
1 parent bdc4bce commit bef9208

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

framework/libraries/Session/drivers/Session_database_driver.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function __construct(&$params)
126126
* @param string $name Session cookie name, unused
127127
* @return bool
128128
*/
129-
public function open(string $save_path, string $name): bool
129+
public function open($save_path, $name): bool
130130
{
131131
if (empty($this->_db->conn_id) && ! $this->_db->db_connect())
132132
{
@@ -149,7 +149,7 @@ public function open(string $save_path, string $name): bool
149149
* @return string Serialized session data
150150
*/
151151
#[\ReturnTypeWillChange]
152-
public function read(string $session_id)
152+
public function read($session_id)
153153
{
154154
if ($this->_get_lock($session_id) === FALSE)
155155
{
@@ -205,7 +205,7 @@ public function read(string $session_id)
205205
* @param string $session_data Serialized session data
206206
* @return bool
207207
*/
208-
public function write(string $session_id, string $session_data): bool
208+
public function write($session_id, $session_data): bool
209209
{
210210
// Prevent previous QB calls from messing with our queries
211211
$this->_db->reset_query();
@@ -294,7 +294,7 @@ public function close(): bool
294294
* @param string $session_id Session ID
295295
* @return bool
296296
*/
297-
public function destroy(string $session_id): bool
297+
public function destroy($session_id): bool
298298
{
299299
if ($this->_lock)
300300
{
@@ -333,7 +333,7 @@ public function destroy(string $session_id): bool
333333
* @return bool
334334
*/
335335
#[\ReturnTypeWillChange]
336-
public function gc(int $maxlifetime)
336+
public function gc($maxlifetime)
337337
{
338338
// Prevent previous QB calls from messing with our queries
339339
$this->_db->reset_query();

framework/libraries/Session/drivers/Session_files_driver.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function __construct(&$params)
129129
* @param string $name Session cookie name
130130
* @return bool
131131
*/
132-
public function open(string $save_path, string $name): bool
132+
public function open($save_path, $name): bool
133133
{
134134
if ( ! is_dir($save_path))
135135
{
@@ -166,7 +166,7 @@ public function open(string $save_path, string $name): bool
166166
* @return string Serialized session data
167167
*/
168168
#[\ReturnTypeWillChange]
169-
public function read(string $session_id)
169+
public function read($session_id)
170170
{
171171
// This might seem weird, but PHP 5.6 introduces session_reset(),
172172
// which re-reads session data
@@ -214,7 +214,7 @@ public function read(string $session_id)
214214
}
215215

216216
$session_data = '';
217-
for ($read = 0, $length = filesize($this->_file_path.$session_id); $read < $length; $read += self::strlen($buffer = ''))
217+
for ($read = 0, $length = filesize($this->_file_path.$session_id); $read < $length; $read += self::strlen($buffer))
218218
{
219219
if (($buffer = fread($this->_file_handle, $length - $read)) === FALSE)
220220
{
@@ -239,7 +239,7 @@ public function read(string $session_id)
239239
* @param string $session_data Serialized session data
240240
* @return bool
241241
*/
242-
public function write(string $session_id, string $session_data): bool
242+
public function write($session_id, $session_data): bool
243243
{
244244
// If the two IDs don't match, we have a session_regenerate_id() call
245245
// and we need to close the old handle and open a new one
@@ -319,7 +319,7 @@ public function close(): bool
319319
* @param string $session_id Session ID
320320
* @return bool
321321
*/
322-
public function destroy(string $session_id): bool
322+
public function destroy($session_id): bool
323323
{
324324
if ($this->close() === $this->_success)
325325
{
@@ -361,7 +361,7 @@ public function destroy(string $session_id): bool
361361
* @return bool
362362
*/
363363
#[\ReturnTypeWillChange]
364-
public function gc(int $maxlifetime)
364+
public function gc($maxlifetime)
365365
{
366366
if ( ! is_dir($this->_config['save_path']) OR ($directory = opendir($this->_config['save_path'])) === FALSE)
367367
{

framework/libraries/Session/drivers/Session_memcached_driver.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function __construct(&$params)
103103
* @param string $name Session cookie name, unused
104104
* @return bool
105105
*/
106-
public function open(string $save_path, string $name): bool
106+
public function open($save_path, $name): bool
107107
{
108108
$this->_memcached = new Memcached();
109109
$this->_memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, TRUE); // required for touch() usage
@@ -161,7 +161,7 @@ public function open(string $save_path, string $name): bool
161161
* @return string Serialized session data
162162
*/
163163
#[\ReturnTypeWillChange]
164-
public function read(string $session_id)
164+
public function read($session_id)
165165
{
166166
if (isset($this->_memcached) && $this->_get_lock($session_id))
167167
{
@@ -187,7 +187,7 @@ public function read(string $session_id)
187187
* @param string $session_data Serialized session data
188188
* @return bool
189189
*/
190-
public function write(string $session_id, string $session_data): bool
190+
public function write($session_id, $session_data): bool
191191
{
192192
if ( ! isset($this->_memcached, $this->_lock_key))
193193
{
@@ -265,7 +265,7 @@ public function close(): bool
265265
* @param string $session_id Session ID
266266
* @return bool
267267
*/
268-
public function destroy(string $session_id): bool
268+
public function destroy($session_id): bool
269269
{
270270
if (isset($this->_memcached, $this->_lock_key))
271271
{
@@ -288,7 +288,7 @@ public function destroy(string $session_id): bool
288288
* @return bool
289289
*/
290290
#[\ReturnTypeWillChange]
291-
public function gc(int $maxlifetime)
291+
public function gc($maxlifetime)
292292
{
293293
// Not necessary, Memcached takes care of that.
294294
return $this->_success;

framework/libraries/Session/drivers/Session_redis_driver.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function __construct(&$params)
181181
* @param string $name Session cookie name, unused
182182
* @return bool
183183
*/
184-
public function open(string $save_path, string $name): bool
184+
public function open($save_path, $name): bool
185185
{
186186
if (empty($this->_config['save_path']))
187187
{
@@ -235,7 +235,7 @@ public function open(string $save_path, string $name): bool
235235
* @return string Serialized session data
236236
*/
237237
#[\ReturnTypeWillChange]
238-
public function read(string $session_id)
238+
public function read($session_id)
239239
{
240240
if (isset($this->_redis) && $this->_get_lock($session_id))
241241
{
@@ -266,7 +266,7 @@ public function read(string $session_id)
266266
* @param string $session_data Serialized session data
267267
* @return bool
268268
*/
269-
public function write(string $session_id, string $session_data): bool
269+
public function write($session_id, $session_data): bool
270270
{
271271
if (!isset($this->_redis, $this->_lock_key))
272272
{
@@ -347,7 +347,7 @@ public function close(): bool
347347
* @param string $session_id Session ID
348348
* @return bool
349349
*/
350-
public function destroy(string $session_id): bool
350+
public function destroy($session_id): bool
351351
{
352352
if (isset($this->_redis, $this->_lock_key))
353353
{
@@ -374,7 +374,7 @@ public function destroy(string $session_id): bool
374374
* @return bool
375375
*/
376376
#[\ReturnTypeWillChange]
377-
public function gc(int $maxlifetime)
377+
public function gc($maxlifetime)
378378
{
379379
// Not necessary, Redis takes care of that.
380380
return $this->_success;

0 commit comments

Comments
 (0)