#42864 [Opn]: strip_tags() doesn't work as expected with PHP tags
| From: | jani@php.net | Date: | Sat, 06 Oct 2007 00:00:42 +0000 |
| Subject: | #42864 [Opn]: strip_tags() doesn't work as expected with PHP tags | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-62@lists.php.net to get a copy of this message | ||
ID: 42864
Updated by: jani@php.net
Reported By: kraghuba at in dot ibm dot com
Status: Open
-Bug Type: Strings related
+Bug Type: Documentation problem
Operating System: windows XP,linux
PHP Version: 5.2.4
New Comment:
According to the sources this is expected behaviour.
And it's pretty simple, <?php $foo=1; ?> is just another tag. So it's
stripped as would something like <img src="foo.gif" /> be sripped..
Previous Comments:
------------------------------------------------------------------------
[2007-10-05 10:39:53] kraghuba at in dot ibm dot com
This behavior is found on php6 as well.
------------------------------------------------------------------------
[2007-10-05 10:37:18] kraghuba at in dot ibm dot com
Description:
------------
when a string with PHP tag(<?php ?>) is given as input to strip_tags()
function, it strips off the entire given string including the tags.
Whereas, the function should only strip the tags and not the text within
the PHP block.
As per the documentation, this seems to be non-documented behavior, is
this expected?
Reproduce code:
---------------
<?php
var_dump(strip_tags("<?php echo \"hello\" ?>"));
?>
Expected result:
----------------
string(12) "echo "hello""
Actual result:
--------------
string(0) ""
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42864&edit=1