Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65541 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37801 invoked from network); 31 Jan 2013 14:35:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2013 14:35:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.21 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.21 smtp1.ist.utl.pt Linux 2.6 Received: from [193.136.128.21] ([193.136.128.21:41264] helo=smtp1.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/91-25207-C218A015 for ; Thu, 31 Jan 2013 09:35:25 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 41FE37000449; Thu, 31 Jan 2013 14:35:21 +0000 (WET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp1.ist.utl.pt ([127.0.0.1]) by localhost (smtp1.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id CWRPY4OoMHnW; Thu, 31 Jan 2013 14:35:21 +0000 (WET) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 01712700045B; Thu, 31 Jan 2013 14:35:20 +0000 (WET) Received: from damnation.nl.lo.geleia.net (unknown [IPv6:2001:470:94a2:4:21d:baff:feee:cc0b]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 92FEC2007721; Thu, 31 Jan 2013 14:35:19 +0000 (WET) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: internals@lists.php.net, "Ivan Enderlin @ Hoa" References: <510A3B71.7060508@hoa-project.net> <510A77CE.2020308@hoa-project.net> Date: Thu, 31 Jan 2013 15:35:14 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Message-ID: In-Reply-To: <510A77CE.2020308@hoa-project.net> User-Agent: Opera Mail/12.12 (Linux) Subject: Re: [PHP-DEV] Proposal: php://memory/ (& ://temp/) From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") 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. 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. -- Gustavo Lopes