1
1
16Gb2018-02-28 13:13:41
PHP
16Gb, 2018-02-28 13:13:41

Why does strip_tags cut off such a string?

Can't he tell this <-+KennY+-> from the html tag?
What to use instead of strip_tags to avoid such garbage?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2018-02-28
@melkij

Can't he tell this <-+KennY+-> from the html tag?

Doesn't even try. Simple state machine
Why do you need strip_tags at all? You shouldn't break user input, you should render it correctly. Those. do htmlspecialchars when outputting to html.

D
Dmitry Kuznetsov, 2018-02-28
@dima9595

Can't he tell this <-+KennY+-> from the html tag?

PHP only uses what its developers have awarded it. He is not an AI that can do everything.
strip_tags looks for the opening ( < ) and closing ( > ) parts of a tag. Accordingly, your "<-+KennY+->" is considered a tag.
I do not know about such things, unfortunately. Try writing a regular expression.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question