Re: Is fgetss() useless?
| From: | Tjerk Meesters | Date: | Tue, 29 Jul 2014 07:06:29 +0000 |
| Subject: | Re: Is fgetss() useless? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76247@lists.php.net to get a copy of this message | ||
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;"
?>
</html> world
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.
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
--
Tjerk