summaryrefslogtreecommitdiffstats
path: root/system/database/DB_driver.php
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2010-08-31 16:42:43 +0200
committerDerek Jones <derek.jones@ellislab.com>2010-08-31 16:42:43 +0200
commitb1e973247b66e0f4dc576484add50c2ebe10125a (patch)
tree9c80207be0914599ee04dc0db80d4c957c1192c2 /system/database/DB_driver.php
parent95b183addfb1683583d401e04f2684ceb86f8b96 (diff)
parent7284f06585a689702ea86684893c999065621460 (diff)
Automated merge with http://hg.ellislab.com/CodeIgniter2
Diffstat (limited to 'system/database/DB_driver.php')
-rw-r--r--system/database/DB_driver.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index dfef42757..8e6f88801 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -1169,6 +1169,24 @@ class CI_DB_driver {
$message = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error;
}
+ // Find the most likely culprit of the error by going through
+ // the backtrace until the source file is no longer in the
+ // database folder.
+
+ $trace = debug_backtrace();
+
+ foreach($trace as $call)
+ {
+ if (isset($call['file']) && strpos($call['file'], BASEPATH.'database') === FALSE)
+ {
+ // Found it - use a relative path for safety
+ $message[] = 'Filename: '.str_replace(array(BASEPATH, APPPATH), '', $call['file']);
+ $message[] = 'Line Number: '.$call['line'];
+
+ break;
+ }
+ }
+
$error =& load_class('Exceptions', 'core');
echo $error->show_error($heading, $message, 'error_db');
exit;