Re: cvs: php4 /ext/standard streamsfuncs.c
| From: | Sara Golemon | Date: | Sat, 19 Apr 2003 19:02:25 +0000 |
| Subject: | Re: cvs: php4 /ext/standard streamsfuncs.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20406@lists.php.net to get a copy of this message | ||
I can easily see a user with an open outgoing stream, writting some header
or other preamble, then wanting to send the contents of an entire file:
stream_copy_to_stream('filename.txt', $stream);
or, equally possible and more descriptive:
fwrite($stream, 'Content-disposition: attachment\r\nContent-encoding:
base64\r\n\r\n');
stream_copy_to_stream('php://filter/base64.encode/resource=filename.txt',
$stream);
Yes this is doable with just a few extra lines of script, but my aim here is
keeping thing simple for the end user.
You don't like overloading either of these functions, that's reasonable and
laudable. However, I don't like have two functions that do each side of a
coin and leave out the middle. Is there a compromise here that can satisfy
us both?
"Moriyoshi Koizumi" <moriyoshi@at.wakwak.com> wrote in message
news:20030419200422'AhNqn@at.wakwak.com...
> Wez Furlong <wez@thebrainroom.com> wrote:
>
> > The purpose of stream_copy_to_stream() is just that; copy data from one
> > stream to another, with an optional length constraint.
> >
> > I don't like the idea of overloading copy() to do this, and I don't like
> > overloading stream_copy_to_stream() to work like copy().
> >
> > If we keep these functions simple, there is less that can go wrong :)
>
> Your words have been drawn out as I expected :)
> Hm, yes, I agree with you Wez, I don't see that big plus to bring such a
> feature onto stream_copy_to_stream().
>
> Moriyoshi
>
>