Installed Phalcon Session Extra Adapters packagist 2.0.0 on PHP 8.3.6 on ubuntu:24.04 using Phalcon 5.8.0 and got the following error message.
Fatal error: Declaration of Phalcon\Incubator\Session\Adapter\Database::gc($maxLifeTime): bool must be compatible with Phalcon\Session\Adapter\AbstractAdapter::gc(int $max_lifetime): int|false in /var/www/vendor/phalcon/incubator-session/src/Adapter/Database.php on line 228
I modified phalcon/incubator-session/src/Adapter/Database.php with following:
< public function gc($maxLifeTime): bool
---
> public function gc($maxLifeTime): int | false
example session handler:
use Phalcon\Session\Manager;
use Phalcon\Db\Adapter\Pdo\Mysql;
use Phalcon\Incubator\Session\Adapter\Database;
$di->set('session', function () use ($di) {
$connection = $di->get('db');
$session = new Manager();
$session_dbh = new Database($connection, 'user_session');
$session->setAdapter($session_dbh);
session_name('whatever');
session_write_close();
$session->start();
return $session;
});
Installed
Phalcon Session Extra Adapterspackagist2.0.0on PHP8.3.6onubuntu:24.04using Phalcon5.8.0and got the following error message.I modified
phalcon/incubator-session/src/Adapter/Database.phpwith following:example session handler: