#42864 [Opn]: strip_tags() doesn't work as expected with PHP tags

From: Date: Fri, 05 Oct 2007 10:39:53 +0000
Subject: #42864 [Opn]: strip_tags() doesn't work as expected with PHP tags
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-118206@lists.php.net to get a copy of this message
 ID:               42864
 User updated by:  kraghuba at in dot ibm dot com
 Reported By:      kraghuba at in dot ibm dot com
 Status:           Open
 Bug Type:         Strings related
 Operating System: windows XP,linux
 PHP Version:      5.2.4
 New Comment:

This behavior is found on php6 as well.


Previous Comments:
------------------------------------------------------------------------

[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


Thread (2 messages)

« previous php.bugs (#118206) next »