Hello guys,
so... fgetss()
. We have such a beautiful function in PHP. As it's
described in the manual: "Get line from file pointer and strip HTML
tags". I'm wondering if it has any differences/advantages over using
just strip_tags(fgets($stream)).
I'm going to write an RFC proposing deprecation and then removal of it,
but first I want to ensure that this function is as useless (IMHO) as I
think.
Best regards,
Maciej.
Hi Maciej,
On Mon, Jul 28, 2014 at 7:21 PM, Maciej Sobaczewski msobaczewski@gmail.com
wrote:
Hello guys,
so...
fgetss()
. We have such a beautiful function in PHP. As it's
described in the manual: "Get line from file pointer and strip HTML tags".
I'm wondering if it has any differences/advantages over using just
strip_tags(fgets($stream)).
The fgetss()
function keeps the strip_tags state between reads to provide
consistent results; observe the following example:
hello <html>
<?php
echo "we don't want this;"
?>
This should rightfully output only "hello world" (and some newlines); if
you would apply strip_tags()
on each individually read line, you would
also get stuff you don't want.
I'm going to write an RFC proposing deprecation and then removal of it,
but first I want to ensure that this function is as useless (IMHO) as I
think.Best regards,
Maciej.--
--
Tjerk
Hello Tjerk,
thanks for the explanation. This is close to what I thought. So, if
there is a difference, I see no point in proposing to remove it. You can
consider this thread as closed ;)
Have a nice day,
Maciej.
Hi Maciej,
On Mon, Jul 28, 2014 at 7:21 PM, Maciej Sobaczewski msobaczewski@gmail.com
wrote:Hello guys,
so...
fgetss()
. We have such a beautiful function in PHP. As it's
described in the manual: "Get line from file pointer and strip HTML tags".
I'm wondering if it has any differences/advantages over using just
strip_tags(fgets($stream)).The
fgetss()
function keeps the strip_tags state between reads to provide
consistent results; observe the following example:hello <html>
</html> world
<?php
echo "we don't want this;"
?>This should rightfully output only "hello world" (and some newlines); if
you would applystrip_tags()
on each individually read line, you would
also get stuff you don't want.I'm going to write an RFC proposing deprecation and then removal of it,
but first I want to ensure that this function is as useless (IMHO) as I
think.Best regards,
Maciej.