Problem/Motivation
When Drupal generates and queues multiple message lines for display, logging_alerts throws the following PHP error: Warning: levenshtein() [function.levenshtein]: Argument string(s) too long in /█/█/█/█/html/sites/all/modules/logging_alerts/emaillog/emaillog.module on line 84.
Proposed resolution
Change
levenshtein($log['type'] . $log['message'], $last_message['message'])
to
levenshtein(explode(", ",$log['type'] . $log['message']), explode(", ",$last_message['message']))
based on the advice found here. This assumes that the messages are comma-delimited, which I have not checked.
Remaining tasks
- Determine in what format Drupal queues messages for display (comma-delimited, or whatever).
- Use this information to determine why levenshtein() doesn't like that format.
- Modify
$log['type'] . $log['message'], $last_message['message']in line 84 to reflect that insight.
User interface changes
None.
API changes
None.
Comments
Comment #0.0
mavaddat commentedFixed ordered list HTML.
Comment #0.1
mavaddat commentedClarified remaining tasks.
Comment #0.2
mavaddat commentedCorrected code citation in Problem/Motivation
Comment #1
Question commentedHi,
Any news about this?
Comment #2
FreeFox commentedI tried that change but it resulted in this error:
Warning: levenshtein() expects parameter 1 to be string, array given in emaillog_watchdog() (line 85 of .../sites/all/modules/contrib/logging_alerts/emaillog/emaillog.module).
Hope this helps.
Comment #3
mavaddat commentedThank you for that, FreeFox. Do you reckon (as I have that) the problem arises from too many system messages being parsed by
levenshtein()at once? I arrived at this conclusion by observing a persistent correlation between this error and multiple messages being printed. Or could problem be elsewhere?Comment #4
FreeFox commentedNo, I guess that levenshtein() expects the first parameter to be string and not an array given in emaillog_watchdog()
Your response made me analyze the error message and now it looks simple. When my project is finished (already past deadline) I'll look into this but feel free (anyone) to check it out as I have 50+ projects to finish :(
Comment #5
deanflory commentedWill there be an update to this module in 2013 to address this issue?
Comment #6
niccottrell commentedLooks like both arguments are strings to me (in the D6 version at least):
According to the PHP docs at http://www.php.net/manual/en/function.levenshtein.php :
So maybe a newer version of PHP would help? Although we already have 5.3.3
Comment #7
maciej.zgadzaj commentedlevenshtein()has been replaced withsimilar_text(), just pushed commits to 7.x-2.x and 6.x-2.x branches.Comment #8.0
(not verified) commentedReverted my last, confused "correction".