-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: ErrorException: Undefined index: file: SYSTEMPATH\Debug\Toolbar\Collectors\Database.php at line 142 #5539
Comments
Thank you for reporting. Could you show us how to reproduce? |
@kenjis As I have mentioned earlier, if you perform a read on any model, the trace line will have the type of function read and since there is no Updating itself is not going to throw errors, it's for when you get data from a table/model and CI_DEBUGGER is enabled. this change (I have referenced it earlier) was added in the latest release (FYI). |
I'm getting the same bug. Not sure how to reproduce it but adding a check before accessing the Here's an example of the |
Correct i also faced same error. it only occur when you set CI_DEBUGGER true. I was using v 4.1.5 and composer installation |
Same issue here. Caused by commit e97b95b |
Could anyone show us the minimum code that reproduce the error? We need to write test code.
Or sending a PR which fixes this issue is very welcome. |
@kenjis I will create a PR for this. |
- Fix for using undefined key of file
I encountered a similar phenomenon.
So I wonder if the logic around the session using DB is the cause. |
@tomomo Thanks! I was able to get the /Users/kenji/work/codeigniter/CodeIgniter4/system/Debug/Toolbar/Collectors/Database.php:139:
array (size=19)
0 =>
array (size=6)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Events/Events.php' (length=67)
'line' => int 149
'function' => string 'collect' (length=7)
'class' => string 'CodeIgniter\Debug\Toolbar\Collectors\Database' (length=45)
'type' => string '::' (length=2)
'args' =>
array (size=1)
0 =>
object(CodeIgniter\Database\Query)[72]
...
1 =>
array (size=6)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Database/BaseConnection.php' (length=77)
'line' => int 636
'function' => string 'trigger' (length=7)
'class' => string 'CodeIgniter\Events\Events' (length=25)
'type' => string '::' (length=2)
'args' =>
array (size=2)
0 => string 'DBQuery' (length=7)
1 =>
object(CodeIgniter\Database\Query)[72]
...
2 =>
array (size=7)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Session/Handlers/DatabaseHandler.php' (length=86)
'line' => int 268
'function' => string 'query' (length=5)
'class' => string 'CodeIgniter\Database\BaseConnection' (length=35)
'object' =>
object(CodeIgniter\Database\MySQLi\Connection)[68]
protected 'DSN' => string '' (length=0)
protected 'port' => int 3306
protected 'hostname' => string 'localhost' (length=9)
protected 'username' => string 'root' (length=4)
protected 'password' => string '' (length=0)
protected 'database' => string 'ci4' (length=3)
public 'DBDriver' => string 'MySQLi' (length=6)
protected 'subdriver' => null
protected 'DBPrefix' => string '' (length=0)
protected 'pConnect' => boolean false
protected 'DBDebug' => boolean true
protected 'charset' => string 'utf8' (length=4)
protected 'DBCollat' => string 'utf8_general_ci' (length=15)
protected 'swapPre' => string '' (length=0)
protected 'encrypt' => boolean false
protected 'compress' => boolean false
protected 'strictOn' => boolean false
protected 'failover' =>
array (size=0)
...
protected 'lastQuery' =>
object(CodeIgniter\Database\Query)[74]
...
public 'connID' =>
object(mysqli)[71]
...
public 'resultID' =>
object(mysqli_result)[76]
...
public 'protectIdentifiers' => boolean true
protected 'reservedIdentifiers' =>
array (size=1)
...
public 'escapeChar' => string '`' (length=1)
public 'likeEscapeStr' => string ' ESCAPE '%s' ' (length=13)
public 'likeEscapeChar' => string '!' (length=1)
protected 'pregEscapeChar' =>
array (size=4)
...
public 'dataCache' =>
array (size=0)
...
protected 'connectTime' => float 1641349430.1933
protected 'connectDuration' => float 0.026990175247192
protected 'pretend' => boolean false
public 'transEnabled' => boolean true
public 'transStrict' => boolean true
protected 'transDepth' => int 0
protected 'transStatus' => boolean true
protected 'transFailure' => boolean false
protected 'aliasedTables' =>
array (size=0)
...
protected 'queryClass' => string 'CodeIgniter\Database\Query' (length=26)
public 'deleteHack' => boolean true
public 'mysqli' =>
object(mysqli)[71]
...
public 'resultMode' => int 0
'type' => string '->' (length=2)
'args' =>
array (size=1)
0 => string 'SELECT GET_LOCK('2b892e0152f080d22f3cb0e6ae38debd', 300) AS ci_session_lock' (length=75)
3 =>
array (size=7)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Session/Handlers/DatabaseHandler.php' (length=86)
'line' => int 111
'function' => string 'lockSession' (length=11)
'class' => string 'CodeIgniter\Session\Handlers\DatabaseHandler' (length=44)
'object' =>
object(CodeIgniter\Session\Handlers\DatabaseHandler)[65]
protected 'fingerprint' => string 'ec15ca5d5a3e707de835bf7a4f33b423' (length=32)
protected 'lock' => string '2b892e0152f080d22f3cb0e6ae38debd' (length=32)
protected 'cookiePrefix' => string '' (length=0)
protected 'cookieDomain' => string '' (length=0)
protected 'cookiePath' => string '/' (length=1)
protected 'cookieSecure' => boolean false
protected 'cookieName' => string 'ci_session' (length=10)
protected 'matchIP' => boolean false
protected 'sessionID' => string '07rfo706ksmjkuiiaedaj760k9mfh2q6' (length=32)
protected 'savePath' => string 'ci_sessions' (length=11)
protected 'ipAddress' => string '::1' (length=3)
protected 'logger' =>
object(CodeIgniter\Log\Logger)[48]
...
protected 'DBGroup' => string 'default' (length=7)
protected 'table' => string 'ci_sessions' (length=11)
protected 'db' =>
object(CodeIgniter\Database\MySQLi\Connection)[68]
...
protected 'platform' => string 'mysql' (length=5)
protected 'rowExists' => boolean true
'type' => string '->' (length=2)
'args' =>
array (size=1)
0 => string '07rfo706ksmjkuiiaedaj760k9mfh2q6' (length=32)
4 =>
array (size=5)
'function' => string 'read' (length=4)
'class' => string 'CodeIgniter\Session\Handlers\DatabaseHandler' (length=44)
'object' =>
object(CodeIgniter\Session\Handlers\DatabaseHandler)[65]
protected 'fingerprint' => string 'ec15ca5d5a3e707de835bf7a4f33b423' (length=32)
protected 'lock' => string '2b892e0152f080d22f3cb0e6ae38debd' (length=32)
protected 'cookiePrefix' => string '' (length=0)
protected 'cookieDomain' => string '' (length=0)
protected 'cookiePath' => string '/' (length=1)
protected 'cookieSecure' => boolean false
protected 'cookieName' => string 'ci_session' (length=10)
protected 'matchIP' => boolean false
protected 'sessionID' => string '07rfo706ksmjkuiiaedaj760k9mfh2q6' (length=32)
protected 'savePath' => string 'ci_sessions' (length=11)
protected 'ipAddress' => string '::1' (length=3)
protected 'logger' =>
object(CodeIgniter\Log\Logger)[48]
...
protected 'DBGroup' => string 'default' (length=7)
protected 'table' => string 'ci_sessions' (length=11)
protected 'db' =>
object(CodeIgniter\Database\MySQLi\Connection)[68]
...
protected 'platform' => string 'mysql' (length=5)
protected 'rowExists' => boolean true
'type' => string '->' (length=2)
'args' =>
array (size=1)
0 => string '07rfo706ksmjkuiiaedaj760k9mfh2q6' (length=32)
5 =>
array (size=4)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Session/Session.php' (length=69)
'line' => int 894
'function' => string 'session_start' (length=13)
'args' =>
array (size=0)
empty
6 =>
array (size=7)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Session/Session.php' (length=69)
'line' => int 238
'function' => string 'startSession' (length=12)
'class' => string 'CodeIgniter\Session\Session' (length=27)
'object' =>
object(CodeIgniter\Session\Session)[69]
protected 'driver' =>
object(CodeIgniter\Session\Handlers\DatabaseHandler)[65]
...
protected 'sessionDriverName' => string 'CodeIgniter\Session\Handlers\DatabaseHandler' (length=44)
protected 'sessionCookieName' => string 'ci_session' (length=10)
protected 'sessionExpiration' => string '7200' (length=4)
protected 'sessionSavePath' => string 'ci_sessions' (length=11)
protected 'sessionMatchIP' => boolean false
protected 'sessionTimeToUpdate' => int 300
protected 'sessionRegenerateDestroy' => boolean false
protected 'cookie' =>
object(CodeIgniter\Cookie\Cookie)[70]
...
protected 'cookieDomain' => string '' (length=0)
protected 'cookiePath' => string '/' (length=1)
protected 'cookieSecure' => boolean false
protected 'cookieSameSite' => string 'Lax' (length=3)
protected 'sidRegexp' => string '[0-9a-v]{32}' (length=12)
protected 'logger' =>
object(CodeIgniter\Log\Logger)[48]
...
'type' => string '->' (length=2)
'args' =>
array (size=0)
empty
7 =>
array (size=7)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Config/Services.php' (length=69)
'line' => int 577
'function' => string 'start' (length=5)
'class' => string 'CodeIgniter\Session\Session' (length=27)
'object' =>
object(CodeIgniter\Session\Session)[69]
protected 'driver' =>
object(CodeIgniter\Session\Handlers\DatabaseHandler)[65]
...
protected 'sessionDriverName' => string 'CodeIgniter\Session\Handlers\DatabaseHandler' (length=44)
protected 'sessionCookieName' => string 'ci_session' (length=10)
protected 'sessionExpiration' => string '7200' (length=4)
protected 'sessionSavePath' => string 'ci_sessions' (length=11)
protected 'sessionMatchIP' => boolean false
protected 'sessionTimeToUpdate' => int 300
protected 'sessionRegenerateDestroy' => boolean false
protected 'cookie' =>
object(CodeIgniter\Cookie\Cookie)[70]
...
protected 'cookieDomain' => string '' (length=0)
protected 'cookiePath' => string '/' (length=1)
protected 'cookieSecure' => boolean false
protected 'cookieSameSite' => string 'Lax' (length=3)
protected 'sidRegexp' => string '[0-9a-v]{32}' (length=12)
protected 'logger' =>
object(CodeIgniter\Log\Logger)[48]
...
'type' => string '->' (length=2)
'args' =>
array (size=0)
empty
8 =>
array (size=6)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Config/BaseService.php' (length=72)
'line' => int 248
'function' => string 'session' (length=7)
'class' => string 'CodeIgniter\Config\Services' (length=27)
'type' => string '::' (length=2)
'args' =>
array (size=2)
0 =>
object(Config\App)[9]
...
1 => boolean false
9 =>
array (size=6)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Config/BaseService.php' (length=72)
'line' => int 189
'function' => string '__callStatic' (length=12)
'class' => string 'CodeIgniter\Config\BaseService' (length=30)
'type' => string '::' (length=2)
'args' =>
array (size=2)
0 => string 'session' (length=7)
1 =>
array (size=2)
...
10 =>
array (size=6)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Config/Services.php' (length=69)
'line' => int 563
'function' => string 'getSharedInstance' (length=17)
'class' => string 'CodeIgniter\Config\BaseService' (length=30)
'type' => string '::' (length=2)
'args' =>
array (size=2)
0 => string 'session' (length=7)
1 => null
11 =>
array (size=6)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Config/BaseService.php' (length=72)
'line' => int 248
'function' => string 'session' (length=7)
'class' => string 'CodeIgniter\Config\Services' (length=27)
'type' => string '::' (length=2)
'args' =>
array (size=0)
empty
12 =>
array (size=6)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Common.php' (length=60)
'line' => int 901
'function' => string '__callStatic' (length=12)
'class' => string 'CodeIgniter\Config\BaseService' (length=30)
'type' => string '::' (length=2)
'args' =>
array (size=2)
0 => string 'session' (length=7)
1 =>
array (size=0)
...
13 =>
array (size=4)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/app/Controllers/Home.php' (length=67)
'line' => int 9
'function' => string 'session' (length=7)
'args' =>
array (size=0)
empty
14 =>
array (size=7)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/CodeIgniter.php' (length=65)
'line' => int 825
'function' => string 'index' (length=5)
'class' => string 'App\Controllers\Home' (length=20)
'object' =>
object(App\Controllers\Home)[64]
protected 'helpers' =>
array (size=0)
...
protected 'request' =>
object(CodeIgniter\HTTP\IncomingRequest)[12]
...
protected 'response' =>
object(CodeIgniter\HTTP\Response)[28]
...
protected 'logger' =>
object(CodeIgniter\Log\Logger)[48]
...
protected 'forceHTTPS' => int 0
protected 'validator' => null
'type' => string '->' (length=2)
'args' =>
array (size=0)
empty
15 =>
array (size=7)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/CodeIgniter.php' (length=65)
'line' => int 412
'function' => string 'runController' (length=13)
'class' => string 'CodeIgniter\CodeIgniter' (length=23)
'object' =>
object(CodeIgniter\CodeIgniter)[10]
protected 'startTime' => float 1641349430.1461
protected 'totalTime' => float 0.087
protected 'config' =>
object(Config\App)[9]
...
protected 'benchmark' =>
object(CodeIgniter\Debug\Timer)[36]
...
protected 'request' =>
object(CodeIgniter\HTTP\IncomingRequest)[12]
...
protected 'response' =>
object(CodeIgniter\HTTP\Response)[28]
...
protected 'router' =>
object(CodeIgniter\Router\Router)[60]
...
protected 'controller' => string '\App\Controllers\Home' (length=21)
protected 'method' => string 'index' (length=5)
protected 'output' => string '<!-- DEBUG-VIEW START 1 APPPATH/Views/welcome_message.php -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Welcome to CodeIgniter 4!</title>
<meta name="description" content="The small framework with powerful features">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/favicon.ico"/>
<!-- STYLES -->
<style {csp-style-nonce}>
* {
transition: background-color 300ms ease, color 300ms ease;
}
*:focu'... (length=18369)
protected 'path' => null
protected 'useSafeOutput' => boolean false
'type' => string '->' (length=2)
'args' =>
array (size=1)
0 =>
object(App\Controllers\Home)[64]
...
16 =>
array (size=7)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/CodeIgniter.php' (length=65)
'line' => int 320
'function' => string 'handleRequest' (length=13)
'class' => string 'CodeIgniter\CodeIgniter' (length=23)
'object' =>
object(CodeIgniter\CodeIgniter)[10]
protected 'startTime' => float 1641349430.1461
protected 'totalTime' => float 0.087
protected 'config' =>
object(Config\App)[9]
...
protected 'benchmark' =>
object(CodeIgniter\Debug\Timer)[36]
...
protected 'request' =>
object(CodeIgniter\HTTP\IncomingRequest)[12]
...
protected 'response' =>
object(CodeIgniter\HTTP\Response)[28]
...
protected 'router' =>
object(CodeIgniter\Router\Router)[60]
...
protected 'controller' => string '\App\Controllers\Home' (length=21)
protected 'method' => string 'index' (length=5)
protected 'output' => string '<!-- DEBUG-VIEW START 1 APPPATH/Views/welcome_message.php -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Welcome to CodeIgniter 4!</title>
<meta name="description" content="The small framework with powerful features">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/favicon.ico"/>
<!-- STYLES -->
<style {csp-style-nonce}>
* {
transition: background-color 300ms ease, color 300ms ease;
}
*:focu'... (length=18369)
protected 'path' => null
protected 'useSafeOutput' => boolean false
'type' => string '->' (length=2)
'args' =>
array (size=3)
0 => null
1 =>
object(Config\Cache)[53]
...
2 => boolean false
17 =>
array (size=7)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/public/index.php' (length=59)
'line' => int 37
'function' => string 'run' (length=3)
'class' => string 'CodeIgniter\CodeIgniter' (length=23)
'object' =>
object(CodeIgniter\CodeIgniter)[10]
protected 'startTime' => float 1641349430.1461
protected 'totalTime' => float 0.087
protected 'config' =>
object(Config\App)[9]
...
protected 'benchmark' =>
object(CodeIgniter\Debug\Timer)[36]
...
protected 'request' =>
object(CodeIgniter\HTTP\IncomingRequest)[12]
...
protected 'response' =>
object(CodeIgniter\HTTP\Response)[28]
...
protected 'router' =>
object(CodeIgniter\Router\Router)[60]
...
protected 'controller' => string '\App\Controllers\Home' (length=21)
protected 'method' => string 'index' (length=5)
protected 'output' => string '<!-- DEBUG-VIEW START 1 APPPATH/Views/welcome_message.php -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Welcome to CodeIgniter 4!</title>
<meta name="description" content="The small framework with powerful features">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/favicon.ico"/>
<!-- STYLES -->
<style {csp-style-nonce}>
* {
transition: background-color 300ms ease, color 300ms ease;
}
*:focu'... (length=18369)
protected 'path' => null
protected 'useSafeOutput' => boolean false
'type' => string '->' (length=2)
'args' =>
array (size=0)
empty
18 =>
array (size=4)
'file' => string '/Users/kenji/work/codeigniter/CodeIgniter4/system/Commands/Server/rewrite.php' (length=77)
'line' => int 43
'args' =>
array (size=1)
0 => string '/Users/kenji/work/codeigniter/CodeIgniter4/public/index.php' (length=59)
'function' => string 'require_once' (length=12) |
Only In this array, there is no 4 =>
array (size=5)
'function' => string 'read' (length=4)
'class' => string 'CodeIgniter\Session\Handlers\DatabaseHandler' (length=44)
'object' =>
object(CodeIgniter\Session\Handlers\DatabaseHandler)[65]
protected 'fingerprint' => string 'ec15ca5d5a3e707de835bf7a4f33b423' (length=32)
protected 'lock' => string '2b892e0152f080d22f3cb0e6ae38debd' (length=32)
protected 'cookiePrefix' => string '' (length=0)
protected 'cookieDomain' => string '' (length=0)
protected 'cookiePath' => string '/' (length=1)
protected 'cookieSecure' => boolean false
protected 'cookieName' => string 'ci_session' (length=10)
protected 'matchIP' => boolean false
protected 'sessionID' => string '07rfo706ksmjkuiiaedaj760k9mfh2q6' (length=32)
protected 'savePath' => string 'ci_sessions' (length=11)
protected 'ipAddress' => string '::1' (length=3)
protected 'logger' =>
object(CodeIgniter\Log\Logger)[48]
...
protected 'DBGroup' => string 'default' (length=7)
protected 'table' => string 'ci_sessions' (length=11)
protected 'db' =>
object(CodeIgniter\Database\MySQLi\Connection)[68]
...
protected 'platform' => string 'mysql' (length=5)
protected 'rowExists' => boolean true
'type' => string '->' (length=2)
'args' =>
array (size=1)
0 => string '07rfo706ksmjkuiiaedaj760k9mfh2q6' (length=32) |
I think this is a php bug related to an internal call. set_exception_handler(function ($e) {
var_dump(debug_backtrace());
});
throw new Exception('test');
//array(1) {
// [0]=>
// array(2) {
// ["function"]=>
// string(9) "{closure}"
// ["args"]=>
// array(1) {
// }
// }
//} same behavior with session_set_save_handler |
@iRedds Thank you for your insight. I found https://bugs.php.net/bug.php?id=44428 |
@kenjis No, I did not report. Checked online php 8.1.1, the behavior is the same. Now I'm not sure if this is a bug. For example, in Kint, if there is no file and line, then the backtrace is marked as php internal calls. CodeIgniter4/system/ThirdParty/Kint/Renderer/Text/TracePlugin.php Lines 49 to 53 in 796acc8
|
Thanks. you're correct. |
Also, in our CLI exception renderer in app/Views/errors/cli/error_exception.php if file is not set then we mark it as internal function.
|
I am using PHP 8.0.11 and I have the same issue... |
For the database session handler, it is because it extends PHP's native From the docs:
Thus, there is no file/line since it is an internal call. |
PHP Version
7.3
CodeIgniter4 Version
v4.1.6
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
MariaDB 10.2
What happened?
The issue is related to the latest build where there seems to be an issue with the trace line of the debugger (Toolbar) when the file attribute is not available.
output log of the trace line causing this issue
Steps to Reproduce
Update from 4.1.5 to 4.1.6.
Expected Output
Maybe check if the file attribute is set?
e97b95b#diff-48dee7e39770b002fe3f48f70db03aaa01fd79d5830d5ee91ee9f8ccda44b4ea
if (!isset($traceLine['file'])) { ...then do the clean-up? }
Anything else?
No response
The text was updated successfully, but these errors were encountered: