Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52098 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82924 invoked from network); 30 Apr 2011 15:23:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2011 15:23:52 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.215.170 mail-ey0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:53886] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/CB-10915-7892CBD4 for ; Sat, 30 Apr 2011 11:23:52 -0400 Received: by eyf5 with SMTP id 5so1409104eyf.29 for ; Sat, 30 Apr 2011 08:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=Nm8xTsCFeLRC+U5Oq2F2ZjDO9RI/Yew08KGrhybQjzI=; b=h1SBSYTeXFNG9h0EL4nEoTnKhYeuHcMYa6nt2pfYyX8kz83/MLghVSI7X1yGvRkoZW jaKH1+rBX5eiBsGK5nGLgtD6H8GAgT6shtZOUtDqhrXrt4ZnVgUhGVPTe0nMUl/7mql0 fEoMmDFpdDca5Ve3Wz5btIR65PBMNUsbr6Tc0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=HjFPPE0JoM06En8UdU07+qQpoueFmCWwRGA4T6UpDvuSPNUtBPK4i/V0COQ8H+DS5B PmUiln/POBR+PrP3o3AONjx9jMzICVyajSlN8HVj+RPjF7aZTnfOKyY2+1q2zKM9QGSy zVk5/ySZ6CERtCYJ39H5Jia0eMxsGMC9ZAhdc= MIME-Version: 1.0 Received: by 10.14.2.31 with SMTP id 31mr2588942eee.167.1304177028542; Sat, 30 Apr 2011 08:23:48 -0700 (PDT) Sender: tyra3l@gmail.com Received: by 10.14.127.79 with HTTP; Sat, 30 Apr 2011 08:23:48 -0700 (PDT) In-Reply-To: References: Date: Sat, 30 Apr 2011 17:23:48 +0200 X-Google-Sender-Auth: 8eFaVFHQI5otgUJF6LxUE8LBJ64 Message-ID: To: Gustavo Lopes Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=0016364268a782b0f704a22460bc Subject: Re: [PHP-DEV] adding low level file handling stuff From: info@tyrael.hu (Ferenc Kovacs) --0016364268a782b0f704a22460bc Content-Type: text/plain; charset=UTF-8 > > I actually did consider adding support for an extended form of php://fd > where one would specify the desired file descriptor: php://fd// fd>. It would call dup2 instead of dup. > > However, I got into some trouble on shutdown because this could cause > stdout to be closed ahead of time and then the output subsystem would cause > either a segfault or a memory leak (can't recall). I didn't spend more than > 20 minutes on this as it was not the problem I was trying to solve, so > there's probably an easy solution. If you want to work on this, extending > php://fd would likely be a good place. > > -- > Gustavo Lopes > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > thanks Gustavo. as you check my mail, I also mentioned using dup2 instead of dup, for obvious reasons. adding dup2 support for the php://fd stream would be better than the current situation, but I can't see why are we trying to force everything into that. I mean everything on the http://www.php.net/manual/en/wrappers.php can be achived through a function also. there are some case when you can save a couple of lines of code with the wrappers and with http://www.php.net/manual/en/context.http.php but there is no method for opening FDs or the dup2 that you mentioned. I think that it would be more consistent with the rest of the language, and one would more likely to find fdopen than fopen('php://fd/1'); in the documentation. closing the stdout without reopening also caused problems for me in case of an error happens, but this shouldn't happen if you properly reopen it, so I would be interested what exactly happened there. Tyrael --0016364268a782b0f704a22460bc--