Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17379 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62661 invoked by uid 1010); 22 Jul 2005 12:36:42 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 62646 invoked from network); 22 Jul 2005 12:36:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jul 2005 12:36:42 -0000 X-Host-Fingerprint: 64.233.184.199 wproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.184.199:60082] helo=wproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6227M)) with SMTP id 0F/83-33635-358E0E24 for ; Fri, 22 Jul 2005 08:36:36 -0400 Received: by wproxy.gmail.com with SMTP id 71so334666wri for ; Fri, 22 Jul 2005 05:36:31 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Pn6t0Un3rrZaNvaFXE6vcHVXbKfxqZZyGPAnBn6AOfGRJ6J62i2wUZOpp991MnUqIAoBFMaVxArPsFbeGIuPrLK9jOdThbd6ODUfM5x0JGikj3mvfsK9tO2akgSNJCMA6gHdCJHzsx0Q/Nl56SdMzm22IV+Xg2VD2WCH0eUt040= Received: by 10.54.99.17 with SMTP id w17mr1140686wrb; Fri, 22 Jul 2005 05:36:31 -0700 (PDT) Received: by 10.54.153.5 with HTTP; Fri, 22 Jul 2005 05:36:28 -0700 (PDT) Message-ID: <4e89b4260507220536439a0eb0@mail.gmail.com> Date: Fri, 22 Jul 2005 08:36:28 -0400 Reply-To: Wez Furlong To: Greg Beaver Cc: internals@lists.php.net In-Reply-To: <46.D7.33635.72170E24@pb1.pair.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <46.D7.33635.72170E24@pb1.pair.com> Subject: Re: [PHP-DEV] new bug in 5.1.0b3 with length param in fread() with local files From: kingwez@gmail.com (Wez Furlong) If you've spotted a behaviour change, open a new bug with a short self-contained reproducing script. I suspect some kind of engine bug here, because what you've described doesn't make sense :) That warning about the length comes from this code in the fread function: len =3D Z_LVAL_PP(arg2); if (len <=3D 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0"); RETURN_FALSE; } So either you are passing in something that evaluates as 0 (or less), or something is corrupting memory and breaking the length value by the time it reaches fread(). I'd recommend running your script under valgrind (--disable-memory-manager when you configure PHP) and see if it reports anything bad. =20 --Wez. On 7/22/05, Greg Beaver wrote: > Hi, >=20 > I have noticed that fread()'s behavior has changed between PHP 5.0.4 and > PHP 5.1.0b3. Basically, http://pear.chiaraquartet.net/go-pear.phar > works in PHP 5.0.4 and fails in 5.1.0b3 because of this change. The > line in question of the .phar from PHP_Archive is: >=20 > fread($this->_file, $this->internalFileLength + > $this->footerLength); >=20 > Basically, a .phar is a .tar. For files inside the .phar larger than > 16000 bytes, the fread above fails with the incorrect error message: >=20 > PHP Warning: fread(): Length parameter must be greater than 0 in > c:\php5\pear\PHP\Archive.php on line 193 >=20 > Note that the failure is OS-independent. >=20 > However, the actual length parameter is 21,155, which is not less than > zero, unless you consider it to be a negative number in binary. After > the fread in PHP 5.0.4, ftell() reveals that the pointer has advanced to > 22016, whereas in 5.1.0b3, it has only advanced to 16384. >=20 > According to the notes in http://bugs.php.net/bug.php?id=3D30936 this > should work with a local file, so should I re-open 30936, or is this a > new bug? >=20 > Greg >=20 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20 >