ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
#29198 [Com]: strip_tags silently strips out tags
by Support At Jevon Dot Org other posts by this author
Dec 27 2004 3:50PM messages near this date
#29198 [Opn->Bgs]: strip_tags silently strips out tags | [PHP-DEV] Clarification needed
ID:               29198
 Comment by:       support at jevon dot org
 Reported By:      steven at acko dot net
 Status:           Open
 Bug Type:         Strings related
 Operating System: Windows 2000
 PHP Version:      5.0.0
 New Comment:

Isn't this already documented?

http://nz2.php.net/strip_tags


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

[2004-07-16 06:01:02] steven at acko dot net

Description:
------------
The strip_tags function is hardcoded to strip out <!...>  tags, such as
comments.

It is IMO expected behaviour for the function that specifying "<!--> "
or "<!DOCTYPE> " in the allowed tags list leaves these intact.

If this is expected behaviour for this function, then the documentation
should be updated.

(PS: The state machine in php_strip_tags() in string.c seems to contain
some redundancies. Someone who understand all of it should take a closer
look ;))

Reproduce code:
---------------
<?php
  print strip_tags("Some text. <!-- a comment -->  Some text.",
"<!--> ");
?> 

Expected result:
----------------
The output should be:
Some text. <!-- a comment -->  Some text.
(with the comment intact)

Actual result:
--------------
The output is:
Some text.  Some text.
(the comment is stripped out)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29198&edit=1
Thread:
steven at acko dot net
Steven At Acko Dot Net
Support At Jevon Dot Org

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved