php-html-parser icon indicating copy to clipboard operation
php-html-parser copied to clipboard

preserveLineBreaks with cleanupInput

Open yveskilchenmann opened this issue 4 years ago • 1 comments

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

yveskilchenmann avatar May 15 '20 07:05 yveskilchenmann

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?

paquettg avatar Jul 17 '20 02:07 paquettg