Re: Proposal: php://memory/<id> (& ://temp/<id>)
| From: | Sebastian Krebs | Date: | Thu, 31 Jan 2013 11:19:00 +0000 |
| Subject: | Re: Proposal: php://memory/<id> (& ://temp/<id>) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65536@lists.php.net to get a copy of this message | ||
2013/1/31 Ivan Enderlin @ Hoa <ivan.enderlin@hoa-project.net>
>
> On 31/01/13 12:00, Sebastian Krebs wrote:
>
>> 2013/1/31 Chris Wright <chrisw@aquacool.ltd.uk>
>>
>> I propose the following syntax:
>>>>
>>>> php://memory/<id>
>>>> php://temp/<id>/maxmemory:<**size>
>>>>
>>> I would very much like to see this as well.
>>>
>>> Would this also allow you to open multiple pointers to the same bucket?
>>>
>>> For example would this work?
>>>
>>> <?php
>>>
>>> $fp = fopen('php://memory/foo', 'w+');
>>>
>>> file_put_contents('php://**memory/foo', 'data');
>>>
>>> rewind($fp); // would this be necessary?
>>>
>>> echo stream_get_contents($fp); // outputs 'data'
>>>
>>>
>> Everything else wouldn't make much sense, because why else should you need
>> to define an id for it?
>>
>> Bu whats about
>>
>>
>> file_put_contents('php://**memory/foo', 'data');
>> $fp = fopen('php://memory/foo', 'w+');
>>
>> 'file_put_contents()' closes the stream after writing. I would expect,
>> that
>> the engine will cleanup the memory (at least sooner or later), but then I
>> open it again.
>>
> Yup, I also expect the engine to clean memory when closing php://memory or
> php://temp, but this is another proposal I think, no?
>
>
> Additional why don't you just pass the open stream around, if you need to
>> access it at multiple places?
>>
> Is this question for me or Chris?
A question for everone :)
> If it is for me, I don't want multiple accesses to the same
> “bucket”/space, I want multiple “buckets”/spaces.
So now I am confused: As far as I can see you can open as many memory- or
temp-streams as you like.
>
>
> Best regards.
>
> --
> Ivan Enderlin
> Developer of Hoa
> http://hoa-project.net/
>
> PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
> http://disc.univ-fcomte.fr/ and
> http://www.inria.fr/
>
> Member of HTML and WebApps Working Group of W3C
> http://w3.org/
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
github.com/KingCrunch