Closed ddevsr closed 1 year ago
You are using DatabaseHandler. Check environment variable for $driver
.
My environment no have variable session config. This show error session sometimes
Where do the query and the sm_sessions
table come from?
mysqli->query('SELECT `data`
FROM `sm_sessions`
WHERE `id` = \'sm_session:jgts8f1jmrvvgdsa7pi3uhuqto06e23r\'
AND `ip_address` = \'127.0.0.1\'', 0)
Updated log
INFO - 2023-04-06 14:01:55 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
ERROR - 2023-04-06 14:01:57 --> mysqli_sql_exception: Unknown column 'data' in 'field list' in D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Database\MySQLi\Connection.php:295
Stack trace:
#0 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Database\MySQLi\Connection.php(295): mysqli->query('SELECT `data`\nF...', 0)
#1 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Database\BaseConnection.php(691): CodeIgniter\Database\MySQLi\Connection->execute('SELECT `data`\nF...')
#2 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Database\BaseConnection.php(605): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT `data`\nF...')
#3 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Database\BaseBuilder.php(1616): CodeIgniter\Database\BaseConnection->query('SELECT `data`\nF...', Array, false)
#4 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Session\Handlers\DatabaseHandler.php(144): CodeIgniter\Database\BaseBuilder->get()
#5 [internal function]: CodeIgniter\Session\Handlers\DatabaseHandler->read('1e3bnk4mavitqr7...')
#6 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Session\Session.php(928): session_start()
#7 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Session\Session.php(250): CodeIgniter\Session\Session->startSession()
#8 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Config\Services.php(674): CodeIgniter\Session\Session->start()
#9 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Config\BaseService.php(252): CodeIgniter\Config\Services::session(Object(Config\App), false)
#10 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Config\BaseService.php(193): CodeIgniter\Config\BaseService::__callStatic('session', Array)
#11 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Config\Services.php(641): CodeIgniter\Config\BaseService::getSharedInstance('session', NULL)
#12 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Config\BaseService.php(252): CodeIgniter\Config\Services::session()
#13 D:\Project\laragon\www\semangkaweb\app\Controllers\BaseController.php(87): CodeIgniter\Config\BaseService::__callStatic('session', Array)
#14 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\CodeIgniter.php(907): App\Controllers\BaseController->initController(Object(CodeIgniter\HTTP\IncomingRequest), Object(CodeIgniter\HTTP\Response), Object(CodeIgniter\Log\Logger))
#15 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\CodeIgniter.php(490): CodeIgniter\CodeIgniter->createController()
#16 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\CodeIgniter.php(368): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#17 D:\Project\laragon\www\semangkaweb\public\index.php(67): CodeIgniter\CodeIgniter->run()
#18 {main}
CRITICAL - 2023-04-06 14:01:57 --> Unknown column 'data' in 'field list'
in SYSTEMPATH\Database\MySQLi\Connection.php on line 295.
1 SYSTEMPATH\Database\MySQLi\Connection.php(295): mysqli->query('SELECT `data`
FROM `sm_sessions`
WHERE `id` = \'sm_session:1e3bnk4mavitqr7st2a5hq17qeu1lni0\'
AND `ip_address` = \'127.0.0.1\'', 0)
2 SYSTEMPATH\Database\BaseConnection.php(691): CodeIgniter\Database\MySQLi\Connection->execute('SELECT `data`
FROM `sm_sessions`
WHERE `id` = \'sm_session:1e3bnk4mavitqr7st2a5hq17qeu1lni0\'
AND `ip_address` = \'127.0.0.1\'')
3 SYSTEMPATH\Database\BaseConnection.php(605): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT `data`
FROM `sm_sessions`
WHERE `id` = \'sm_session:1e3bnk4mavitqr7st2a5hq17qeu1lni0\'
AND `ip_address` = \'127.0.0.1\'')
4 SYSTEMPATH\Database\BaseBuilder.php(1616): CodeIgniter\Database\BaseConnection->query('SELECT `data`
FROM `sm_sessions`
WHERE `id` = :id:
AND `ip_address` = :ip_address:', [...], false)
5 SYSTEMPATH\Session\Handlers\DatabaseHandler.php(144): CodeIgniter\Database\BaseBuilder->get()
6 [internal function]: CodeIgniter\Session\Handlers\DatabaseHandler->read('1e3bnk4mavitqr7st2a5hq17qeu1lni0')
7 SYSTEMPATH\Session\Session.php(928): session_start()
8 SYSTEMPATH\Session\Session.php(250): CodeIgniter\Session\Session->startSession()
9 SYSTEMPATH\Config\Services.php(674): CodeIgniter\Session\Session->start()
10 SYSTEMPATH\Config\BaseService.php(252): CodeIgniter\Config\Services::session(Object(Config\App), false)
11 SYSTEMPATH\Config\BaseService.php(193): CodeIgniter\Config\BaseService::__callStatic('session', [...])
12 SYSTEMPATH\Config\Services.php(641): CodeIgniter\Config\BaseService::getSharedInstance('session', null)
13 SYSTEMPATH\Config\BaseService.php(252): CodeIgniter\Config\Services::session()
14 APPPATH\Controllers\BaseController.php(87): CodeIgniter\Config\BaseService::__callStatic('session', [])
15 SYSTEMPATH\CodeIgniter.php(907): App\Controllers\BaseController->initController(Object(CodeIgniter\HTTP\IncomingRequest), Object(CodeIgniter\HTTP\Response), Object(CodeIgniter\Log\Logger))
16 SYSTEMPATH\CodeIgniter.php(490): CodeIgniter\CodeIgniter->createController()
17 SYSTEMPATH\CodeIgniter.php(368): CodeIgniter\CodeIgniter->handleRequest(null, Object(Config\Cache), false)
18 FCPATH\index.php(67): CodeIgniter\CodeIgniter->run()
The Session was initialized using FileHandler at 14:01:55. And two seconds later, the MySQL query was executed. Two seconds is a very long time.
INFO - 2023-04-06 14:01:55 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
ERROR - 2023-04-06 14:01:57 --> mysqli_sql_exception: Unknown column 'data' in 'field list' in D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Database\MySQLi\Connection.php:295
Its manual refresh in browser.
INFO - 2023-04-06 14:01:55 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
ERROR - 2023-04-06 14:01:57 --> mysqli_sql_exception: Unknown column 'data' in 'field list' in D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Database\MySQLi\Connection.php:295
Stack trace:
#0 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Database\MySQLi\Connection.php(295): mysqli->query('SELECT `data`\nF...', 0)
#1 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Database\BaseConnection.php(691): CodeIgniter\Database\MySQLi\Connection->execute('SELECT `data`\nF...')
#2 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Database\BaseConnection.php(605): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT `data`\nF...')
#3 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Database\BaseBuilder.php(1616): CodeIgniter\Database\BaseConnection->query('SELECT `data`\nF...', Array, false)
#4 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Session\Handlers\DatabaseHandler.php(144): CodeIgniter\Database\BaseBuilder->get()
#5 [internal function]: CodeIgniter\Session\Handlers\DatabaseHandler->read('1e3bnk4mavitqr7...')
#6 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Session\Session.php(928): session_start()
#7 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Session\Session.php(250): CodeIgniter\Session\Session->startSession()
#8 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Config\Services.php(674): CodeIgniter\Session\Session->start()
#9 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Config\BaseService.php(252): CodeIgniter\Config\Services::session(Object(Config\App), false)
#10 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Config\BaseService.php(193): CodeIgniter\Config\BaseService::__callStatic('session', Array)
#11 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Config\Services.php(641): CodeIgniter\Config\BaseService::getSharedInstance('session', NULL)
#12 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\Config\BaseService.php(252): CodeIgniter\Config\Services::session()
#13 D:\Project\laragon\www\semangkaweb\app\Controllers\BaseController.php(87): CodeIgniter\Config\BaseService::__callStatic('session', Array)
#14 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\CodeIgniter.php(907): App\Controllers\BaseController->initController(Object(CodeIgniter\HTTP\IncomingRequest), Object(CodeIgniter\HTTP\Response), Object(CodeIgniter\Log\Logger))
#15 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\CodeIgniter.php(490): CodeIgniter\CodeIgniter->createController()
#16 D:\Project\laragon\www\semangkaweb\vendor\codeigniter4\framework\system\CodeIgniter.php(368): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#17 D:\Project\laragon\www\semangkaweb\public\index.php(67): CodeIgniter\CodeIgniter->run()
#18 {main}
CRITICAL - 2023-04-06 14:01:57 --> Unknown column 'data' in 'field list'
in SYSTEMPATH\Database\MySQLi\Connection.php on line 295.
1 SYSTEMPATH\Database\MySQLi\Connection.php(295): mysqli->query('SELECT `data`
FROM `sm_sessions`
WHERE `id` = \'sm_session:1e3bnk4mavitqr7st2a5hq17qeu1lni0\'
AND `ip_address` = \'127.0.0.1\'', 0)
2 SYSTEMPATH\Database\BaseConnection.php(691): CodeIgniter\Database\MySQLi\Connection->execute('SELECT `data`
FROM `sm_sessions`
WHERE `id` = \'sm_session:1e3bnk4mavitqr7st2a5hq17qeu1lni0\'
AND `ip_address` = \'127.0.0.1\'')
3 SYSTEMPATH\Database\BaseConnection.php(605): CodeIgniter\Database\BaseConnection->simpleQuery('SELECT `data`
FROM `sm_sessions`
WHERE `id` = \'sm_session:1e3bnk4mavitqr7st2a5hq17qeu1lni0\'
AND `ip_address` = \'127.0.0.1\'')
4 SYSTEMPATH\Database\BaseBuilder.php(1616): CodeIgniter\Database\BaseConnection->query('SELECT `data`
FROM `sm_sessions`
WHERE `id` = :id:
AND `ip_address` = :ip_address:', [...], false)
5 SYSTEMPATH\Session\Handlers\DatabaseHandler.php(144): CodeIgniter\Database\BaseBuilder->get()
6 [internal function]: CodeIgniter\Session\Handlers\DatabaseHandler->read('1e3bnk4mavitqr7st2a5hq17qeu1lni0')
7 SYSTEMPATH\Session\Session.php(928): session_start()
8 SYSTEMPATH\Session\Session.php(250): CodeIgniter\Session\Session->startSession()
9 SYSTEMPATH\Config\Services.php(674): CodeIgniter\Session\Session->start()
10 SYSTEMPATH\Config\BaseService.php(252): CodeIgniter\Config\Services::session(Object(Config\App), false)
11 SYSTEMPATH\Config\BaseService.php(193): CodeIgniter\Config\BaseService::__callStatic('session', [...])
12 SYSTEMPATH\Config\Services.php(641): CodeIgniter\Config\BaseService::getSharedInstance('session', null)
13 SYSTEMPATH\Config\BaseService.php(252): CodeIgniter\Config\Services::session()
14 APPPATH\Controllers\BaseController.php(87): CodeIgniter\Config\BaseService::__callStatic('session', [])
15 SYSTEMPATH\CodeIgniter.php(907): App\Controllers\BaseController->initController(Object(CodeIgniter\HTTP\IncomingRequest), Object(CodeIgniter\HTTP\Response), Object(CodeIgniter\Log\Logger))
16 SYSTEMPATH\CodeIgniter.php(490): CodeIgniter\CodeIgniter->createController()
17 SYSTEMPATH\CodeIgniter.php(368): CodeIgniter\CodeIgniter->handleRequest(null, Object(Config\Cache), false)
18 FCPATH\index.php(67): CodeIgniter\CodeIgniter->run()
INFO - 2023-04-06 14:05:57 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:06:43 --> CSRF token verified.
INFO - 2023-04-06 14:06:43 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:06:44 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:06:51 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:06:53 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:49:34 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:49:37 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:49:38 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:49:41 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:49:44 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:49:46 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:49:47 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:49:48 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:49:50 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:50:40 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:50:41 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:50:42 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:50:44 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:50:45 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:50:46 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:50:47 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
INFO - 2023-04-06 14:50:48 --> Session: Class initialized using 'CodeIgniter\Session\Handlers\FileHandler' driver.
I will close, back after found this.
PHP Version
8.1
CodeIgniter4 Version
4.3.3
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
No response
What happened?
I have session configuration default by CI using Filehandler and set property session in BaseController like
$this->session = Services::session();
for getFlashData if login failed. In v4.2.12 its OK. And now sometimes no error sometimes error when refreshed.Steps to Reproduce
Config\App
:Config\Session
:Expected Output
No error
Anything else?
No response