Skip to content
Snippets Groups Projects
Commit 40ae2aa7 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#508738 by terrychild, Eric_A: prevent the padding in drupalhtml_to_text() from falling below zero

parent 221d7fdb
No related branches found
No related tags found
No related merge requests found
......@@ -475,7 +475,7 @@ function _drupal_html_to_text_pad($text, $pad, $prefix = '') {
if (($p = strrpos($text, "\n")) === FALSE) {
$p = -1;
}
$n = max(0, 79 - (strlen($text) - $p));
$n = max(0, 79 - (strlen($text) - $p) - strlen($prefix));
// Add prefix and padding, and restore linebreak.
return $text . $prefix . str_repeat($pad, $n - strlen($prefix)) ."\n";
return $text . $prefix . str_repeat($pad, $n) ."\n";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment