On 31/01/13 15:35, Gustavo Lopes wrote:
On Thu, 31 Jan 2013 14:55:26 +0100, Ivan Enderlin @ Hoa <ivan.ender...@hoa-project.net> wrote:

I'm not sure what you mean here. Each time you open a php://memory stream, you're working on a new "bucket", right?
Yes exact. My bad. But my proposal still persist. Identifying php://memory buckets would be nice to retrieve them. For example:

     $f1 = fopen('php://memory/foo', 'r+');
     fwrite($f1, 'foobar');
     unset($f1);

     $f1prime = fopen('php://memory/foo', 'r+');
     rewind($f1);
     var_dump(stream_get_contents($f1)); // string(6) "foobar"

Is it interesting? In this way, we have a similar behavior than php://fd/<i>, file://, http:// etc.


No. When you do unset($f1), you're closing the file and the memory is reclaimed. That's how it's supposed to be.
Ok.


Just pass the stream along. If you really need to use operations on the URLs themselves, you can easily write a user wrapper that delegates to static php://memory streams kept statically.
That's what I did.

Thank you for the clarification.

--
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

Reply via email to