Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52428 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97698 invoked from network); 17 May 2011 14:31:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 May 2011 14:31:55 -0000 Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:35988] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/D0-27887-7D682DD4 for ; Tue, 17 May 2011 10:31:52 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id EE01070003D5 for ; Tue, 17 May 2011 15:22:03 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id Oi2HpZzgizrM for ; Tue, 17 May 2011 15:22:03 +0100 (WEST) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id B169470003D2 for ; Tue, 17 May 2011 15:22:00 +0100 (WEST) Received: from clk-0081.clk-domain (unknown [85.139.253.17]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id A33F420089AC for ; Tue, 17 May 2011 15:22:00 +0100 (WEST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: internals@lists.php.net References: Date: Tue, 17 May 2011 15:21:59 +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: User-Agent: Opera Mail/11.10 (Win32) Subject: Re: [PHP-DEV] Need karma for committing test patches From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") Em Tue, 17 May 2011 14:40:53 +0100, Alexey Shein escreveu: > 2) fix for http://bugs.php.net/48203: there's a segfault when > CURLOPT_STDERR file pointer is closed before calling curl_exec, i.e. > like this: > > $fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w'); > > $ch = curl_init(); > > curl_setopt($ch, CURLOPT_VERBOSE, 1); > curl_setopt($ch, CURLOPT_STDERR, $fp); > curl_setopt($ch, CURLOPT_URL, getenv("PHP_CURL_HTTP_REMOTE_SERVER")); > > fclose($fp); // <-- premature close of $fp caused a crash! > > curl_exec($ch); // segfault > > All tests run ok on php5.3 php5.4 and trunk. > Could somebody review this patch since I'm new to developing php and > could make some silly mistakes? > A few remarks: * Isn't this supposed to be fixed? Was there something that triggered a regression? * If this strategy is used (checking whether the resource associated with the stored zval is valid), how about curl_multi_exec? * I think a better strategy would be to just dup the file descriptor gotten after the cast in curl_setopt, store it (instead of storing the zval) and close it on curl handle destruction. This way we wouldn't have to worry about zval refcounts or whether the file descriptor obtained is still valid. Could you see if this other strategy works? (otherwise I can do it later this week) -- Gustavo Lopes