Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Bug in DB_driver.php method display_error() #1692

bolemeus opened this Issue · 4 comments

3 participants


I noticed a bug in the method display_error() whilst looking for a way to generate neat error messages using the display_error() method.

I figured the best way to do this way to look how codeigniter handles errors itself.

I noticed that the backtrace is being evaluated to check which file and line-number is the culprit for the error, but I also noticed that database errors always show me the DB_driver.php class with line-number 330.

This shouldn't be the error found according to the condition:

isset($call['file']) && strpos($call['file'], BASEPATH.'database') === FALSE //line 1180

I found that the method strpos($call['file'], BASEPATH.'database') always returns false on the first call of the trace because $call['file'] and BASEPATH are formatted differently.

print_r($call['file']) returns:

whilst print_r(BASEPATH) returns

This is a slashes vs backslashes issue...

replacing line 1180 by...

if (isset($call['file']) && strpos($call['file'], FCPATH.SYSDIR.'\'.'database') === FALSE)

seems to do the trick. It now shows the file causing the error...


Could you send a pull request?


I'm quite new to git, but I'll try. ;)


I've made a pull request according to a github guide, but I accidentally duplicated the issue...
The other issue is issue #1693


Pull requests automatically create issues.

@narfbg narfbg referenced this issue from a commit
@narfbg narfbg Fix issue #1692 1194ad7
@narfbg narfbg closed this
@nonchip nonchip referenced this issue from a commit in nonchip/CodeIgniter
@narfbg narfbg Fix issue #1692 1ad9ea0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.