php-html-parser
php-html-parser copied to clipboard
preserveLineBreaks with cleanupInput
when the option "cleanupInput" is set to "false", then the option "preserveLineBreaks" gets ignored.
i fixed this by just copying out the lines:
$replace = ' ';
if ($this->options->get('preserveLineBreaks')) {
$replace = ' ';
}
$str = str_replace(["\r\n", "\r", "\n"], $replace, $str);
if ($str === false) {
throw new LogicalException('str_replace returned false instead of a string. Error when attempting to clean input string.');
}
and put them at the start of the clean function, just before cleanupInput got checked
This is the documented behavior, preserveLineBreaks is not intended to work if you set cleanupInput to false.
Is their something specific you are trying to avoid by setting up cleanupInput to false?