Permalink
Browse files

Fix: Added a bool parameter to Lang::line() to bypass error logging

Bug: Unit_test.php bloats the error_log when calling report().
Incorrect keys are sent to the Lang class causing many errors to be
logged.
  • Loading branch information...
1 parent 5ff5a3f commit 63a07c32a13688b9e39ba4f1d164e6be9b0d08ff @ziyun committed Sep 27, 2012
Showing with 5 additions and 4 deletions.
  1. +3 −2 system/core/Lang.php
  2. +2 −2 system/libraries/Unit_test.php
View
@@ -149,14 +149,15 @@ public function load($langfile, $idiom = '', $return = FALSE, $add_suffix = TRUE
* Fetch a single line of text from the language array
*
* @param string $line the language line
+ * @param bool $log bypass error logging
* @return string
*/
- public function line($line = '')
+ public function line($line = '', $log = TRUE)
{
$value = ($line === '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line];
// Because killer robots like unicorns!
- if ($value === FALSE)
+ if ($value === FALSE && $log)
{
log_message('error', 'Could not find the language line "'.$line.'"');
}
@@ -240,7 +240,7 @@ public function result($results = array())
{
foreach ($val as $k => $v)
{
- if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$v))))
+ if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$v), FALSE)))
{
$v = $line;
}
@@ -249,7 +249,7 @@ public function result($results = array())
}
else
{
- if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val))))
+ if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val), FALSE)))
{
$val = $line;
}

0 comments on commit 63a07c3

Please sign in to comment.