|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12860 problem with strip_tags()
Submitted: 2001-08-20 09:45 UTC Modified: 2001-08-22 19:15 UTC
From: costrova at prdel dot cz Assigned:
Status: Closed Package: Strings related
PHP Version: 4.0.6 OS: Linux and Win
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: costrova at prdel dot cz
New email:
PHP Version: OS:


 [2001-08-20 09:45 UTC] costrova at prdel dot cz
When I have text exported from MS Word to HTML where is "<?xml:namespace..." (see $string) and I want strip tags from it, I get text before it only.


$string = <<<EOD
<BODY><P class=MsoNormal><B><U>I am hungry<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /></U></B></P> <P class=MsoNormal>I am really hungry<o:p></o:p></SPAN></BODY>  



output is:

string(11) "I am hungry"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-20 11:02 UTC]
This markup is not XHTML 1.0 compliant, from my readying.
That is, I'm pretty sure <?xml ...> must be the first line
of the document.

This, however, is not the reason why strip_tags is failing.
It is failing because it recognises '<?' (from <?xml ) as
the beginning of PHP code - not xml. This presents problems
with applying strip_tags to xhtml. The reason why this
probably hasn't been picked up is that correct (??) XML
declarations are of the form <?xml ... ?> - which should
not contain anything to be out put anyway.

If you/anyone can show that this is valid we can work
around it (by demoting the PHP strip_tags state to an HTML state).
 [2001-08-21 05:50 UTC] costrova at prdel dot cz
It is done by MS Word and I can?t affect it.
Although it isn't compliant, I think, that is a bug. Fnc strip_tags() has strip all tags anywhere inside the string. 
I can't check, if all tags in the string are valid.
If you want to show if this is valid, I would have to call to Redmond :-)
 [2001-08-21 22:02 UTC]
Latest CVS now checks if <? is followed by 'xml'. If so,
it treats it just like HTML.

Check latest CVS to confirm that this works (

 [2001-08-22 19:15 UTC]
erm, why does strip_tags() allow PHP tags in the first place? this doesn't look right.. (am I missing something?)
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Sep 16 12:03:37 2021 UTC