Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26638 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38676 invoked by uid 1010); 16 Nov 2006 04:47:38 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 38661 invoked from network); 16 Nov 2006 04:47:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Nov 2006 04:47:37 -0000 Authentication-Results: pb1.pair.com header.from=pollita@php.net; sender-id=unknown; domainkeys=good Authentication-Results: pb1.pair.com smtp.mail=pollita@php.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain php.net from 140.211.166.39 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pollita@php.net X-Host-Fingerprint: 140.211.166.39 osu1.php.net Linux 2.4/2.6 Received: from [140.211.166.39] ([140.211.166.39:44666] helo=osu1.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/04-03218-86DEB554 for ; Wed, 15 Nov 2006 23:47:37 -0500 X-DomainKeys: Ecelerity dk_sign implementing draft-delany-domainkeys-base-01 DomainKey-Signature: q=dns; a=rsa-sha1; c=nofws; s=mx; d=php.net; h=From:Subject:To:Date; b=sXY/fOk0kG7+19YHxG3bWLoaOEMKPPVkhvD4lOoX7+PuK2XXeFNraGj93QfS8PG2 j8vNBJpjzAyGgCGQ+8gYuxMgNxZIq9D1ROumW/z48mE8uJvBjKsFnb5qt0/sn+V7 Authentication-Results: osu1.php.net smtp.user=pollita; auth=pass (LOGIN) X-Host-Fingerprint: 69.12.155.129 unknown Received: from [69.12.155.129] ([69.12.155.129:56606] helo=[172.31.5.146]) by osu1.php.net (ecelerity 2.1.1.11-rc1 r(13363/13364M)) with ESMTPSA (cipher=AES256-SHA) id 32/50-07913-64EEB554 for ; Wed, 15 Nov 2006 20:51:19 -0800 Message-ID: <455BEDA4.4090608@php.net> Date: Wed, 15 Nov 2006 20:48:36 -0800 User-Agent: Thunderbird 1.5.0.8 (Macintosh/20061025) MIME-Version: 1.0 To: zeev@zend.com, stas@zend.com CC: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] fgets()/fgetss() BC break in HEAD From: pollita@php.net (Sara Golemon) Zeev- > My IQ is higher than 12, and I don't see how defensive coding could have > defended against this BC break. This code is missing error checking, > but that could be quite reasonable (e.g. if you check ahead of time that > the file is big enough to match the format you're expecting - so it's > not perfect, but it's quite reasonable). But even if it did have error > checking, it would look something like this: > You're ignoring the fact that fgets() is the wrong tool for this job. This is something for fread(). "I want to read precisely X bytes. I know! I'll use a function which halts at a newline character." This isn't accidental reasoning of someone who "doesn't have the time to read every page of the manual", This is taking antibiotics for a flu. > So, after the BC break, it'd barf. There's really no way to protect > against this BC break, and it's pretty clear this behavior is being > relied upon. > By one project. Which is very clearly using fgets() to do what fgetc() should be doing. >>> Or change the docs and the variable name to something other than >>> maxchars is a perfect solution. :-) >> Yes, and that's what I said both in this thread and on IRC before the >> thread started. > > That's fine by me, but I think it's a different issue. The BC break > should be reverted irregardless... > Just to be clear, noone's arguing against reversion. I accepted before this thread ever started that while the current logic is broken, there's no driving force to fix it. Stas- Please don't misquote me. While I admit my crack about the stupidity of anyone relying on this behavior was uncalled for, your fictionalized summary was just that. Fiction. Get your facts straight. -Sara