Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65540 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33395 invoked from network); 31 Jan 2013 13:55:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2013 13:55:32 -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:34844] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/01-25207-2D77A015 for ; Thu, 31 Jan 2013 08:55:31 -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 154CD20AC13 for ; Thu, 31 Jan 2013 14:55:27 +0100 (CET) Message-ID: <510A77CE.2020308@hoa-project.net> Date: Thu, 31 Jan 2013 14:55:26 +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> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Proposal: php://memory/ (& ://temp/) From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") On 31/01/13 12:18, Gustavo Lopes wrote: > On Thu, 31 Jan 2013 10:37:53 +0100, Ivan Enderlin @ Hoa=20 > wrote: > >> The php://memory, and its respectful sibling php://temp, appear very >> useful when we need to compute streams on-the-fly. They offer a lot of= >> services, like avoiding HDD accesses, increasing speed... and through = a >> straightforward API /=C3=A0 la/ PHP, e.g. fopen('php://memory', 'r+').= >> However, we always work on the same "bucket"/space of data (per >> runtime), which prevent us to use two different streams at a time. My >> proposal is to allow access to many "buckets"/spaces to php://memory a= nd >> its sibling. >> > > I'm not sure what you mean here. Each time you open a php://memory=20 > stream, you're working on a new "bucket", right? Yes exact. My bad. But my proposal still persist. Identifying=20 php://memory buckets would be nice to retrieve them. For example: $f1 =3D fopen('php://memory/foo', 'r+'); fwrite($f1, 'foobar'); unset($f1); $f1prime =3D 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=20 php://fd/, file://, http:// etc. Best regards. --=20 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/