Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65542 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39348 invoked from network); 31 Jan 2013 14:39:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2013 14:39:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.12.24 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.12.24 host1.trois-doubles.net Linux 2.6 Received: from [95.130.12.24] ([95.130.12.24:60214] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1D/E1-25207-2028A015 for ; Thu, 31 Jan 2013 09:38:59 -0500 Received: from Hwhost2.local (adsl-84-227-209-114.adslplus.ch [84.227.209.114]) by host1.trois-doubles.net (Postfix) with ESMTPSA id 7F1D020AC13 for ; Thu, 31 Jan 2013 15:38:55 +0100 (CET) Message-ID: <510A81FE.7030601@hoa-project.net> Date: Thu, 31 Jan 2013 15:38:54 +0100 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:20.0) Gecko/20100101 Thunderbird/20.0a2 MIME-Version: 1.0 To: internals@lists.php.net References: <510A3B71.7060508@hoa-project.net> <510A77CE.2020308@hoa-project.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Proposal: php://memory/ (& ://temp/) From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") On 31/01/13 15:35, Gustavo Lopes wrote: > On Thu, 31 Jan 2013 14:55:26 +0100, Ivan Enderlin @ Hoa > 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/, 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/