-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Some time ago, I posted a bug in the output that contains invalid
tags. The bug I reported is here: CherryFramework/CherryFramework#17Unfortunately, this still remains valid bug. I took a look myself at the code and I traced the problem to the function remove_invalid_tags() which is supposed to fix these invalid tags, but it does not.
For example, I copy/pasted your function to demonstrate the problem:
[code]
function remove_invalid_tags($str, $tags) {
foreach($tags as $tag) {
$str = preg_replace('#^</'.$tag.'>|<'.$tag.'>$#', '', trim($str));
}
return $str;
}
$html = 'test
echo "original: ".$html."\n";
echo "fixed : ".remove_invalid_tags($html, array('p'))."\n";
[/code]
The output is:
[code]
$ php -f ./test.php
original: test
fixed : test
[/code]
As you can see, the broken tag is never removed, because the regex in the preg_replace misses it.
Metadata
Metadata
Assignees
Labels
No labels