Re: Proposal: php://memory/<id> (& ://temp/<id>)
| From: | Ivan Enderlin @ Hoa | Date: | Thu, 31 Jan 2013 11:04:23 +0000 |
| Subject: | Re: Proposal: php://memory/<id> (& ://temp/<id>) | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65535@lists.php.net to get a copy of this message | ||
On 31/01/13 12:00, Sebastian Krebs wrote:
2013/1/31 Chris Wright <chrisw@aquacool.ltd.uk>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?I propose the following syntax: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'php://memory/<id> php://temp/<id>/maxmemory:<size>
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? If it is for me, I don't want multiple accesses to the same “bucket”/space, I want multiple “buckets”/spaces.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/