Bug #75971 [Com]: strip_tags removes incorrect part of string
| From: | subjective@php.net | Date: | Fri, 16 Feb 2018 18:25:43 +0000 |
| Subject: | Bug #75971 [Com]: strip_tags removes incorrect part of string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213993@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75971&edit=1
ID: 75971
Comment by: subjective@php.net
Reported by: barahtyan at gmail dot com
Summary: strip_tags removes incorrect part of string
Status: Not a bug
Type: Bug
Package: Strings related
Operating System: Ubuntu 16.04
PHP Version: 7.1.14
Block user comment: N
Private report: N
New Comment:
strip_tags() is a pretty aggressive string function, not a "real" HTML/XML parser. So this
should be the expected behavior:
From the manual:
Warning: Because strip_tags() does not actually validate the HTML, partial or broken tags can result
in the removal of more text/data than expected.
Previous Comments:
------------------------------------------------------------------------
[2018-02-16 18:25:26] requinix@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
> Warning
> Because strip_tags() does not actually validate the HTML, partial or broken tags can result in
> the removal of more
> text/data than expected.
------------------------------------------------------------------------
[2018-02-16 18:10:36] barahtyan at gmail dot com
Description:
------------
echo strip_tags('test <------ Test');
I expect to receive the same "test <------ Test", since there is not tags.
Unfortunately, PHP removes all string after <------.
I пÑе "test " without <------ Test.
Test script:
---------------
echo strip_tags('test <------ Test');
Expected result:
----------------
test <------ Test
Actual result:
--------------
test
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75971&edit=1