Could not find the language line """" - El Forum - 05-02-2011
[eluser]Unknown[/eluser]
Hi,
I'm using the Email library inside my Authentication library. When I send a password to my e-mailadress I'm getting the error "Could not find the language line ''" in my logfiles. When I remove the e-mail part I'm not getting this error.
This is my code:
Code: if ($this->CI->Auth_model->reset_password($email, $password)) {
$this->CI->email->from('[email protected]', 'Your Name');
$this->CI->email->to($email);
$this->CI->email->subject('Email Test');
$this->CI->email->message($password);
$this->CI->email->send();
return TRUE;
}
I'm using Codegigniter 2.0.2.
Is this a bug?
Could not find the language line """" - El Forum - 05-02-2011
[eluser]Michael02[/eluser]
Yes it is a bug, i was just about to post the fix
the current code in core/lang.php
Code: function line($line = '')
{
$line = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line];
// Because killer robots like unicorns!
if ($line === FALSE)
{
log_message('error', 'Could not find the language line "'.$line.'"');
}
return $line;
}
will never show the line info in your debug files
should be changed to
Code: function line($input = '')
{
$line = ($input == '' OR ! isset($this->language[$input])) ? FALSE : $this->language[$input];
// Because killer robots like unicorns!
if ($line === FALSE)
{
log_message('error', 'Could not find the language line "'.$input.'"');
}
return $line;
}
Could not find the language line """" - El Forum - 05-02-2011
[eluser]Michael02[/eluser]
because i had to look into this function i had to see if i could make it faster
and i can make it faster assuming the input line is defined, or its slower
heres my test code and results, and yes i test small things like this i have a dedicated controller for it.
Code: function line_test_function()
{
$loops = 10000; // high number so you can see a diffrence in times, every littel bit counts
$this->output->enable_profiler( TRUE );
// loading core language files (easy ones to type im lazy)
$this->lang->load('date');
$this->lang->load('calendar');
$this->lang->load('db');
$this->lang->load('imglib');
$this->lang->load('upload');
// to contain this test to this class/controller
$this->language = $this->lang->language;
/* I like to see it
echo '<pre>';
print_r( $this->language ) ;
echo '</pre>';
*/
// testing with undefined line
echo ' Undefined input <br/>';
echo '<p> testing line("");';
$start_time = microtime();
for( $x=0 ; $x < $loops ; $x++ )
$this->line('test_undefined_line_can_never_be_found');
$end_time = microtime();
echo ' Start = ' . $start_time . ' End = '. $end_time ;
$elapsed_time = $end_time - $start_time;
echo ' Elapsed Time = '. $elapsed_time .'</p>';
echo '<p> testing line2("");';
$start_time = microtime();
for( $x=0 ; $x < $loops ; $x++ )
$this->line2('test_undefined_line_can_never_be_found');
$end_time = microtime();
echo ' Start = ' . $start_time . ' End = '. $end_time ;
$elapsed_time = $end_time - $start_time;
echo ' Elapsed Time = '. $elapsed_time .'</p>';
echo '<p> testing line3("");';
$start_time = microtime();
for( $x=0 ; $x < $loops ; $x++ )
$this->line3('test_undefined_line_can_never_be_found');
$end_time = microtime();
echo ' Start = ' . $start_time . ' End = '. $end_time ;
$elapsed_time = $end_time - $start_time;
echo ' Elapsed Time = '. $elapsed_time .'</p>';
// testing with a defined line
echo ' Defined input <br/>';
echo '<p> testing line("cal_december"); defined input';
$start_time = microtime();
for( $x=0 ; $x < $loops ; $x++ )
$this->line('cal_december'); // cal_december chosin because its in the middle of the array and short
$end_time = microtime();
echo ' Start = ' . $start_time . ' End = '. $end_time ;
$elapsed_time = $end_time - $start_time;
echo ' Elapsed Time = '. $elapsed_time .'</p>';
echo '<p> testing line2("cal_december");';
$start_time = microtime();
for( $x=0 ; $x < $loops ; $x++ )
$this->line2('cal_december');
$end_time = microtime();
echo ' Start = ' . $start_time . ' End = '. $end_time ;
$elapsed_time = $end_time - $start_time;
echo ' Elapsed Time = '. $elapsed_time .'</p>';
echo '<p> testing line3("cal_december");';
$start_time = microtime();
for( $x=0 ; $x < $loops ; $x++ )
$this->line3('');
$end_time = microtime();
echo ' Start = ' . $start_time . ' End = '. $end_time ;
$elapsed_time = $end_time - $start_time;
echo ' Elapsed Time = '. $elapsed_time .'</p>';
}
function line($input = '')
{
$line = ($input == '' OR ! isset($this->language[$input])) ? FALSE : $this->language[$input];
// Because killer robots like unicorns!
if ($line === FALSE)
{
log_message('error', 'Could not find the language line "'.$input.'"');
}
return $line;
}
function line2($input = '')
{
if( isset($this->language[$input]) )
{
return $this->language[$input];
}
else
{
// Because killer robots like unicorns!
log_message('error', 'Could not find the language line "'.$input.'"');
return FALSE;
}
}
function line3($input = '')
{
// Because killer robots like unicorns!
return( isset($this->language[$input]) ) ? $this->language[$input] : log_message('error', 'Could not find the language line "'.$input.'"');
}
and my results
Code: Undefined input
testing line(""); Start = 0.58805300 1304386977 End = 0.22405500 1304386978 Elapsed Time = -0.363998
testing line2(""); Start = 0.22407300 1304386978 End = 0.85278100 1304386978 Elapsed Time = 0.628708
testing line3(""); Start = 0.85280000 1304386978 End = 0.48189500 1304386979 Elapsed Time = -0.370905
Defined input
testing line("cal_december"); defined input Start = 0.48191300 1304386979 End = 0.49304000 1304386979 Elapsed Time = 0.011127
testing line2("cal_december"); Start = 0.49304500 1304386979 End = 0.50135600 1304386979 Elapsed Time = 0.008311
testing line3("cal_december"); Start = 0.50136200 1304386979 End = 0.12952300 1304386980 Elapsed Time = -0.371839
Could not find the language line """" - El Forum - 05-03-2011
[eluser]Unknown[/eluser]
[quote author="Michael02" date="1304398247"]Yes it is a bug, i was just about to post the fix
the current code in core/lang.php
Code: function line($line = '')
{
$line = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line];
// Because killer robots like unicorns!
if ($line === FALSE)
{
log_message('error', 'Could not find the language line "'.$line.'"');
}
return $line;
}
will never show the line info in your debug files
should be changed to
Code: function line($input = '')
{
$line = ($input == '' OR ! isset($this->language[$input])) ? FALSE : $this->language[$input];
// Because killer robots like unicorns!
if ($line === FALSE)
{
log_message('error', 'Could not find the language line "'.$input.'"');
}
return $line;
}
[/quote]
Thank you! That worked for me. But now I'm getting the error:
Code: ERROR - 2011-05-03 16:36:11 --> Could not find the language line "220 mx.google.com ESMTP y15sm91650eeh.27"
ERROR - 2011-05-03 16:36:13 --> Could not find the language line "250 2.0.0 OK 1304433373 y15sm91650eeh.27"
(I'm sending via Gmail's SMTP my e-mails)
Could not find the language line """" - El Forum - 06-14-2011
[eluser]Nom4d3[/eluser]
I think the bug is on Email Library.
I fixed this issue changing the lines below on /system/libraries/Email.php
Line 1646:
Code: $this->_set_error_message($reply);
to
Code: $this->_set_error_message('email_smtp_error', $reply);
and
Line 1681:
Code: $this->_set_error_message($this->_get_smtp_data());
to
Code: $this->_set_error_message('email_smtp_error', $this->_get_smtp_data());
Could not find the language line """" - El Forum - 06-14-2011
[eluser]oskarols[/eluser]
[quote author="Nom4d3" date="1308077262"]I think the bug is on Email Library.
I fixed this issue changing the lines below on /system/libraries/Email.php
Line 1646:
Code: $this->_set_error_message($reply);
to
Code: $this->_set_error_message('email_smtp_error', $reply);
and
Line 1681:
Code: $this->_set_error_message($this->_get_smtp_data());
to
Code: $this->_set_error_message('email_smtp_error', $this->_get_smtp_data());
[/quote]
I was having a poke at this issue as well.
While that solution will stop the errors from being pushed to the log, those two lines don't really denote errors at all - they just want to push debugging data to the debug_msg-array. If you ever use the print_debugger method, it will show errors when there aren't any.
My temporary fix was to use:
Code: $this->debug_msg[] = $reply
and
Code: $this->debug_msg[] = _get_smtp_data()
respectively.
Both of these issues are resolved in the tip of the Codeigniter Reactor repository, although they took a slightly different route.
|