Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45521 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30133 invoked from network); 8 Sep 2009 16:44:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Sep 2009 16:44:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=garretts@microsoft.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=garretts@microsoft.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain microsoft.com designates 131.107.115.215 as permitted sender) X-PHP-List-Original-Sender: garretts@microsoft.com X-Host-Fingerprint: 131.107.115.215 mail2.microsoft.com Received: from [131.107.115.215] ([131.107.115.215:28242] helo=smtp.microsoft.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F1/B0-26597-CF986AA4 for ; Tue, 08 Sep 2009 12:44:46 -0400 Received: from TK5EX14MLTC101.redmond.corp.microsoft.com (157.54.79.178) by TK5-EXGWY-E802.partners.extranet.microsoft.com (10.251.56.168) with Microsoft SMTP Server (TLS) id 8.2.176.0; Tue, 8 Sep 2009 09:44:41 -0700 Received: from TK5EX14MBXC127.redmond.corp.microsoft.com ([169.254.6.236]) by TK5EX14MLTC101.redmond.corp.microsoft.com ([157.54.79.178]) with mapi; Tue, 8 Sep 2009 09:44:37 -0700 To: Stanislav Malyshev CC: 'PHP Internals' Thread-Topic: [PHP-DEV] Fix for 49148 (combination of stream_get_line and fseek does not work correctly) Thread-Index: AQHKLBReRR5UABK2xkOGr9gfVRgblpDD0KoAgAI6gwCABuKkIA== Date: Tue, 8 Sep 2009 16:44:34 +0000 Message-ID: References: <4A9EE046.4090500@zend.com> <4AA05FCC.2000501@zend.com> In-Reply-To: <4AA05FCC.2000501@zend.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: [PHP-DEV] Fix for 49148 (combination of stream_get_line and fseek does not work correctly) From: garretts@microsoft.com (Garrett Serack) Well, that's a really good question. Pre-patch, at the end of the stream (when you don't explicitly seek), you g= et empty strings: --example.php-- $tmp =3D tmpfile(); fwrite($tmp, "line1\r\n"); fseek($tmp, 0); var_dump(stream_get_line($tmp, null, "\r\n")); var_dump(stream_get_line($tmp, null, "\r\n")); var_dump(stream_get_line($tmp, null, "\r\n")); var_dump(stream_get_line($tmp, null, "\r\n")); var_dump(stream_get_line($tmp, null, "\r\n")); fclose($tmp); ----------------- --results-- string(5) "line1" string(0) "" string(0) "" string(0) "" string(0) "" ----------------- Do you want to change the behavior so that it does return false? It's trivi= al to do (and I'd agree that it would be correct), but it does change the b= ehavior from the current behavior. G -----Original Message----- From: Stanislav Malyshev [mailto:stas@zend.com]=20 Sent: Thursday, September 03, 2009 5:31 PM To: Garrett Serack Cc: 'PHP Internals' Subject: Re: [PHP-DEV] Fix for 49148 (combination of stream_get_line and fs= eek does not work correctly) Hi! > it happens on Linux and Windows. I've repro'd it in both places. >=20 > The bug submitter hadn't tested elsewhere. You are right. However, I notice something strange with your patch - if=20 I call stream_get_line again with the same parameters I get "".=20 Shouldn't I get false instead, as it's at EOF? fgets() returns false. --=20 Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com