From 1194ad733135214e9905123258df3600b01735fd Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 5 Oct 2012 17:05:46 +0300 Subject: Fix issue #1692 --- system/database/DB_driver.php | 10 ++++++++-- user_guide_src/source/changelog.rst | 5 +++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index b64b977cb..acba9c187 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1348,7 +1348,7 @@ abstract class CI_DB_driver { } else { - $message = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error; + $message = is_array($error) ? $error : array(str_replace('%s', $swap, $LANG->line($error))); } // Find the most likely culprit of the error by going through @@ -1357,7 +1357,13 @@ abstract class CI_DB_driver { $trace = debug_backtrace(); foreach ($trace as $call) { - if (isset($call['file'], $call['class']) && strpos($call['file'], BASEPATH.'database') === FALSE && strpos($call['class'], 'Loader') !== FALSE) + // We'll need this on Windows, as APPPATH and BASEPATH will always use forward slashes + if (DIRECTORY_SEPARATOR !== '/') + { + $call['file'] = str_replace('\\', '/', $call['file']); + } + + if (isset($call['file'], $call['class']) && strpos($call['file'], $basepath.'database') === FALSE && strpos($call['class'], 'Loader') !== FALSE) { // Found it - use a relative path for safety $message[] = 'Filename: '.str_replace(array(APPPATH, BASEPATH), '', $call['file']); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index b3fbe718b..5cfd795b1 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -350,8 +350,9 @@ Bug fixes for 3.0 - Fixed a bug in SQLSRV's ``affected_rows()`` method where an erroneous function name was used. - Fixed a bug (#1000) - Change syntax of ``$view_file`` to ``$_ci_view_file`` to prevent being overwritten by application. - Fixed a bug (#1757) - :doc:`Directory Helper ` function ``directory_map()`` was skipping files and directories named *0*. -- Fixed a bug (#1789) - :doc:`Database Library ` method ``escape_str()`` escaped quote characters in LIKE conditions twice under MySQL. -- Fixed a bug (#395) - :doc:`Unit Testing Library ` method ``result()`` didn't properly check array result columns when called from ``report()``. +- Fixed a bug (#1789) - :doc:`Database Library ` method ``escape_str()`` escaped quote characters in LIKE conditions twice under MySQL. +- Fixed a bug (#395) - :doc:`Unit Testing Library ` method ``result()`` didn't properly check array result columns when called from ``report()``. +- Fixed a bug (#1692) - :doc:`Database Library ` method ``display_error()`` didn't properly trace the possible error source on Windows systems. Version 2.1.2 ============= -- cgit v1.2.3-24-g4f1b