Skip to content

Unclosed </p> tags in the generate column output #8

@ghost

Description

Some time ago, I posted a bug in the output that contains invalid

tags. The bug I reported is here: CherryFramework/CherryFramework#17

Unfortunately, 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions