When entering multiple email addresses in the send to a friend page, if the person puts both a comma AND a newline, this causes an invalid notification of email address which is missing.
This is caused by a problem with the conversion of end of lines into commas. (print_mail.inc, line 180)
// All new-lines are replaced by commas
$to_addrs = str_replace(array("\r\n", "\n", "\r"), ',', $form_state['values']['txt_to_addrs']);
// Create an array from the string
$to_array = explode(',', $to_addrs);
If this is changed instead to
// All new-lines are replaced by commas
$to_addrs = preg_replace("/(\r\n|\n|\r|,)+/", ",", $form_state['values']['txt_to_addrs']);
// Create an array from the string
$to_array = explode(',', $to_addrs);
multiple commas, newlines or other user entry problems are handled in a cleaner fashion.
It also then matches the description underneath the form entry textarea.
Comments
Comment #1
jcnventuraThanks for providing the patch together with the problem report! I appreciate it a lot.
I improved the fix slightly (if you think about it, specifying \r\n to the preg_replace was completely superfluous), but the patch credit is totally yours.
I have committed it now, and it will be in the dev version in a few hours.
João