Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46469 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82173 invoked from network); 18 Dec 2009 23:55:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Dec 2009 23:55:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.185 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.185 il-mr1.zend.com Received: from [212.25.124.185] ([212.25.124.185:60974] helo=il-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/52-63064-D761C2B4 for ; Fri, 18 Dec 2009 18:55:44 -0500 Received: from us-gw1.zend.com (unknown [192.168.16.5]) by il-mr1.zend.com (Postfix) with ESMTP id 2340550521; Sat, 19 Dec 2009 01:41:03 +0200 (IST) Received: from [192.168.16.93] ([192.168.16.93]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 18 Dec 2009 15:55:33 -0800 Message-ID: <4B2C1675.7090201@zend.com> Date: Fri, 18 Dec 2009 15:55:33 -0800 Organization: Zend Technologies User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Lightning/1.0b1pre Thunderbird/3.0 MIME-Version: 1.0 To: Garrett Serack CC: 'PHP Internals' References: <4A9EE046.4090500@zend.com> <4AA05FCC.2000501@zend.com> <4AA8251A.6010004@zend.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 18 Dec 2009 23:55:33.0596 (UTC) FILETIME=[964539C0:01CA803D] Subject: Re: [PHP-DEV] Fix for 49148 (combination of stream_get_line and fseek does not work correctly) From: stas@zend.com (Stanislav Malyshev) Hi! > I've updated my patch to return null on EOF. Unfortunately, on Linux this patch fails test stream_get_line_nb.phpt - looks like it changes the stream behavior in the non-blocking case. > Index: streams/streams.c > =================================================================== > --- streams/streams.c (revision 289073) > +++ streams/streams.c (working copy) > @@ -890,6 +890,9 @@ > size_t seek_len; > > seek_len = stream->writepos - stream->readpos; > + if(!seek_len) > + return FALSE; > + > if (seek_len> maxlen) { > seek_len = maxlen; > } > @@ -901,10 +904,7 @@ > } > > if (!e) { > - if (seek_len< maxlen&& !stream->eof) { > - return NULL; > - } > - toread = maxlen; > + toread = (seek_len< maxlen) ? seek_len : maxlen; > } else { > toread = e - (char *) stream->readbuf - stream->readpos; > skip = 1; > > > -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com