Ok, thank you - will continue to test via the web. This is fine as the main route also creates a session.
The current issue is that with the new replacement app/Config/Services.php, which eventually hits `$this->logger->info("Session: Class initialized using '" . $this->config->driver . "' driver.");` inside of vendor/codeigniter4/framework/system/Session/Session.php or it's new replacement (clone) app/Libraries/Session.php - if either of these Session.php files are used (from the new app/Config/Services.php file) (see below) The web page is throwing an error as null: `Call to a member function info() on null`.
PHP Code:
<?php
// app/Config/Services.php
namespace Config;
use CodeIgniter\Config\BaseService;
use CodeIgniter\Session\Session;
use Config\Session as SessionConfig;
use Config\Services as AppServices;
use CodeIgniter\Session\Handlers\DatabaseHandler;
use CodeIgniter\Session\Handlers\Database\MySQLiHandler;
use CodeIgniter\Session\Handlers\Database\PostgreHandler;
/**
* Services Configuration file.
*
* Services are simply other classes/libraries that the system uses
* to do its job. This is used by CodeIgniter to allow the core of the
* framework to be swapped out easily without affecting the usage within
* the rest of your application.
*
* This file holds any application-specific services, or service overrides
* that you might need. An example has been included with the general
* method format you should use for your service methods. For more examples,
* see the core Services file at system/Config/Services.php.
*/
class Services extends BaseService
{
public static function session($getShared = true)
{
if ($getShared) {
return static::getSharedInstance('session');
}
$config ??= config(SessionConfig::class);
$logger = AppServices::logger();
// var_dump($logger);die;
$driverName = $config->driver;
if ($driverName === DatabaseHandler::class) {
var_dump('DatabaseHandler');die;
$DBGroup = $config->DBGroup ?? config(Database::class)->defaultGroup;
$db = Database::connect($DBGroup);
$driver = $db->getPlatform();
if ($driver === 'MySQLi') {
$driverName = MySQLiHandler::class;
} elseif ($driver === 'Postgre') {
$driverName = PostgreHandler::class;
}
}
$driver = new $driverName($config, AppServices::request()->getIPAddress());
$driver->setLogger($logger);
//$session = new \App\Libraries\Session($driver, new SessionConfig());
$session = new Session($driver, $config);
if (session_status() === PHP_SESSION_NONE) {
$session->start();
}
return $session;
}
}