Req #78364 [Opn]: strip_tags should not remove \x00
| From: | bkfake-php at yahoo dot com | Date: | Fri, 02 Aug 2019 00:42:20 +0000 |
| Subject: | Req #78364 [Opn]: strip_tags should not remove \x00 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222058@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78364&edit=1
ID: 78364
User updated by: bkfake-php at yahoo dot com
Reported by: bkfake-php at yahoo dot com
Summary: strip_tags should not remove \x00
Status: Open
Type: Feature/Change Request
Package: Strings related
Operating System: osx
PHP Version: 7.3.8
Block user comment: N
Private report: N
New Comment:
In my case I'm working with "plain text" that may have had html tags added somewhere
upstream..
Previous Comments:
------------------------------------------------------------------------
[2019-08-01 22:17:07] requinix@php.net
:)
Doing some research, I see HTML 5 allows NULs sometimes, but I can't tell how HTML 4 feels
about it. If there was a particular reason strip_tags removed them then the behavior should probably
stay, but otherwise I think it's a (undoubtedly rare) edge case that should be fine to remove.
------------------------------------------------------------------------
[2019-08-01 21:58:48] peehaa@php.net
Sorry Damien you were too fast again :-)
Want to change it back to FR?
------------------------------------------------------------------------
[2019-08-01 21:57:20] peehaa@php.net
This is clearly documented.
https://www.php.net/manual/en/function.trim.php
------------------------------------------------------------------------
[2019-08-01 21:55:35] requinix@php.net
Undocumented? Are you sure about that?
------------------------------------------------------------------------
[2019-08-01 21:50:50] bkfake-php at yahoo dot com
Description:
------------
strip_tags strips the null character \x00 from the string
this is neither documented nor desired behavior
tested on v5.6.40 and 7.1.25 - 7.4.0beta1
Test script:
---------------
// outputs "where'd null go?"
$str = "hello\x00world";
$strAfter = strip_tags($str);
if ($str == $strAfter) {
echo 'all is well';
} else {
echo "where'd null go?";
}
Expected result:
----------------
null char should remain and output "all is well"
Actual result:
--------------
outputs "where'd null go?"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78364&edit=1