Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6669

Re: strip_tags function

Message-ID <9739408.O9o76ZdvQC@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-07-27 11:52 +0200
Subject Re: strip_tags function
Newsgroups comp.lang.php
References <mgu218tlttv5gelvjj2jpcf8na6tmq876f@4ax.com> <r9v2181fv3eh22o3p9s9u3aluus3m48q3t@4ax.com>
Followup-To comp.lang.php

Followups directed to: comp.lang.php

Show all headers | View raw


Tim Fardell wrote:

> On Thu, 26 Jul 2012 18:18:44 +0100, Tim Fardell
> <tim.fardell.all-your-clothes@virgin.net> wrote:
>> However, am I right in thinking that the strip_tags() function simply
>> assumes that any less-than character (<) occurring within a string is the
>> beginning of a tag?
>>
>> I hope I'm wrong, because that would be completely crap and useless :-)
> 
> […]
> I think I am correct that strip_tags assumes any '<' character to be the
> beginning of a tag - 

No, you are not.  The function, at least as of PHP 5.3.10, is context-
sensitive:

$ php -r "echo strip_tags('<a title=\'<\'>foo</a>');"
foo

> ut this doesn't actually matter, since the input string should be HTML
> encoded anyway, so all '<' characters should be escaped as '&lt;' - so all
> actual '<' characters will indeed be tags :-)

You are not making sense.  The *input* data should *never* be "HTML 
encoded".


PointedEars 
-- 
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
  -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

strip_tags function Tim Fardell <tim.fardell.all-your-clothes@virgin.net> - 2012-07-26 18:18 +0100
  Re: strip_tags function Tim Fardell <tim.fardell.all-your-clothes@virgin.net> - 2012-07-26 18:27 +0100
    Re: strip_tags function The Natural Philosopher <tnp@invalid.invalid> - 2012-07-26 19:24 +0100
      Re: strip_tags function Gregor Kofler <usenet@gregorkofler.com> - 2012-07-26 23:54 +0200
    Re: strip_tags function "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-07-27 08:25 +0200
    Re: strip_tags function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-07-27 11:52 +0200
      Re: strip_tags function Tim Fardell <tim.fardell.all-your-clothes@virgin.net> - 2012-07-27 18:25 +0100
        Re: strip_tags function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-07-28 12:42 +0200
          Re: strip_tags function Tim Fardell <tim.fardell.all-your-clothes@virgin.net> - 2012-07-31 20:17 +0100
            Re: strip_tags function Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-31 15:30 -0400
              Re: strip_tags function Tim Fardell <tim.fardell.all-your-clothes@virgin.net> - 2012-07-31 20:37 +0100
                Re: strip_tags function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-01 06:56 +0200
                Re: strip_tags function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-01 07:15 +0200
            Re: strip_tags function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-01 06:49 +0200

csiph-web