Re: Re: Bug #11675 Updated: zzip_open() has a wrong arg count and doesn't validate arg2 correctly
| From: | Daniel Beckham | Date: | Wed, 27 Jun 2001 01:16:32 +0000 |
| Subject: | Re: Re: Bug #11675 Updated: zzip_open() has a wrong arg count and doesn't validate arg2 correctly | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-58122@lists.php.net to get a copy of this message | ||
I'll take a closer look at the docs tonight and make any necessary
corrections. I recently finished those docs and thought they reflected the
current version in cvs.
Daniel
----- Original Message -----
From: <phpbug@robin.pfft.net>
To: "Bug Database" <php-dev@lists.php.net>
Sent: Tuesday, June 26, 2001 9:55 AM
Subject: [PHP-DEV] Re: Bug #11675 Updated: zzip_open() has a wrong arg count
and doesn't validate arg2 correctly
> My bug report was for 4.0.6. If it is corrected in cvs, fine. The
> online documentation doesn't match 4.0.6 and I think you should at least
> make note of it.
>
> thanks
> /Robin
>
>
> On 26 Jun 2001, Bug Database wrote:
>
> > Date: 26 Jun 2001 14:44:18 -0000
> > From: Bug Database <php-dev@lists.php.net>
> > To: phpbug@robin.pfft.net
> > Subject: Bug #11675 Updated: zzip_open() has a wrong arg count and
> > doesn't validate arg2 correctly
> >
> > ID: 11675
> > Updated by: danbeck
> > Reported By: phpbug@robin.pfft.net
> > Status: Closed
> > Bug Type: ZZiplib Related
> > Operating system:
> > PHP Version: 4.0.6
> > Assigned To:
> > Comments:
> >
> > Please see the Zip section of the online manual for details:
> >
> > http://php.net/manual/en/ref.zip.php
> >
> > Previous Comments:
>
> --------------------------------------------------------------------------
-
> >
> > [2001-06-26 05:58:30] sniper@php.net
> > In the CVS the zziplib has been changed a bit:
> >
> > @ Renamed the ZZiplib extension to the Zip extension, function
> > @ names have also changed accordingly, functionality, has stayed
> > @ constant. (Sterling)
> >
> > zzip_open() is now zip_entry_open() and doesn't have this bug in it.
> >
> > --Jani
> >
> >
> >
>
> --------------------------------------------------------------------------
-
> >
> > [2001-06-25 16:14:31] phpbug@robin.pfft.net
> > Fix:
> >
> > --- ../../php-4.0.6/ext/zziplib/zziplib.c Thu May 24 07:42:14 2001
> > +++ ext/zziplib/zziplib.c Mon Jun 25 14:31:59 2001
> > @@ -234,13 +234,13 @@
> > ZZIP_DIR *archive_p = NULL;
> > php_zzip_dirent *entry = NULL;
> >
> > - if (ZEND_NUM_ARGS() != 2 ||
> > + if (ZEND_NUM_ARGS() != 3 ||
> > zend_get_parameters_ex(3, &zzip_dp, &zzip_ent, &mode) ==
FAILURE) {
> > WRONG_PARAM_COUNT;
> > }
> >
> > ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, zzip_dp, -1, "ZZIP
Directory", le_zzip_dir);
> > - ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_dp, -1, "ZZIP
Entry", le_zzip_entry);
> > + ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1,
"ZZIP Entry", le_zzip_entry);
> >
> > entry->fp = zzip_file_open(archive_p, entry->dirent.d_name,
O_RDONLY|O_BINARY);
> >
> >
> > After this is fixed, the correct usage seems to be:
> >
> > <?php
> > $zzip = zzip_opendir("foo.zip");
> >
> > if($zzip)
> > {
> > while ($zzip_entry = zzip_readdir($zzip))
> > {
> > echo "zzip_entry_name: " . zzip_entry_name($zzip_entry) . "n";
> > echo "zzip_entry_filesize: " . zzip_entry_filesize($zzip_entry) .
"n";
> >
> > if(zzip_open($zzip, $zzip_entry, "r"))
> > {
> > $buf = zzip_read($zzip_entry, zzip_entry_filesize($zzip_entry));
> > zzip_close($zzip_entry);
> > echo "read: " . strlen($buf) . " bytesn";
> > }
> > }
> > zzip_closedir($zzip);
> > }
> > ?>
> >
> >
>
> --------------------------------------------------------------------------
-
> >
> > [2001-06-25 16:09:44] phpbug@robin.pfft.net
> > See patch at: http://pfft.net/robin/pub/zzip.patch
> >
> > Then, correct use seems to be:
> > $zzip = zzip_opendir("foo.zip");
> > if($zzip)
> > {
> > while ($zzip_entry = zzip_readdir($zzip))
> > {
> > echo "zzip_entry_name: " . zzip_entry_name($zzip_entry) . "n";
> > echo "zzip_entry_filesize: " . zzip_entry_filesize($zzip_entry) .
"n";
> >
> > if(zzip_open($zzip, $zzip_entry, "r"))
> > {
> > $buf = zzip_read($zzip_entry, zzip_entry_filesize($zzip_entry));
> > zzip_close($zzip_entry);
> > echo "read: " . strlen($buf) . " bytesn";
> > }
> > }
> > zzip_closedir($zzip);
> > }
> >
>
> --------------------------------------------------------------------------
-
> >
> >
> >
> > ATTENTION! Do NOT reply to this email!
> > To reply, use the web interface found at
http://bugs.php.net/?id=11675&edit=2
> >
>
> --
> Robin Thellend <robin@pfft.net>
> PFFT! http://pfft.net
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>