CodeIgniter Developer Toolbar is a third party library based on Profiler Library with additional functionality for debugging and optimisation, Database, Models, Helpers, Libraries, Views, Ajax...
MIT License
176
stars
57
forks
source link
Bug in application\third_party\DevelBar\views\develbar\database.php #31
On a fresh install of Code Igniter 3.1.10, I received an error:
This error can be reproduced on any page with no SQL query.
There is indeed a problem in the code. At line 10 && 26, you access $db like an array:
Line 10:
echo '-' . $db['hostname'] . '#' . lang('database') . ' : ' . $db['database'] . '<br/>';
Line 26:
$total_execution_time = array_sum($db['query_times']);
But, line 36, you access it like an object:
echo '-' . $db->hostname . '#' . lang('database') . ' : ' . $db->database .' : ' . lang('no_queries').'<br/>';
Because all the lines are part of an if / else structure, there is no valid reason to change the way you access the variable.
Especially, on a fresh CI install,
$dbs
is an array so it's indeed impossible to access it like an object.The fix is to edit line 36:
echo '-' . $db['hostname'] . '#' . lang('database') . ' : ' . $db['database'] .' : ' . lang('no_queries').'<br/>';