Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Apr 10, 2015 · 0 comments
Open

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

ghost opened this issue Apr 10, 2015 · 0 comments

Comments

@ghost
Copy link

ghost commented Apr 10, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants