Re: Re: Bug #11675 Updated: zzip_open() has a wrong arg count and doesn't validate arg2 correctly

From: Date: Wed, 27 Jun 2001 02:02:59 +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-58126@lists.php.net to get a copy of this message
Daniel, Thanks a lot for the heads-up. I appreciate it a lot. regards, /Robin On Tue, 26 Jun 2001, Daniel Beckham wrote: > Date: Tue, 26 Jun 2001 20:42:58 -0500 > From: Daniel Beckham <danbeck@dealnews.com> > To: phpbug@robin.pfft.net > Cc: Bug Database <php-dev@lists.php.net> > Subject: Re: [PHP-DEV] Re: Bug #11675 Updated: zzip_open() has a wrong > arg count and doesn't validate arg2 correctly > > Hmm.. right after sending that last message, I realized what was going on. > The 4.0.6 version had been branched off the main trunk for quite some time > while it was going through the release process. During that time, Sterling > Hughes, the zip extension author, made a large number of changes and since > the documentation itself is very recent, it reflects the current state of > the Zip extension in cvs. (4.0.7-dev) > > I will make a note in the docs that this extension is marked as > 'EXPERIMENTAL' and that the current documentation is only good for 4.0.7 and > later. I apologize for the confusion, I should have noted this when I first > commited the docs to cvs. > > BTW, you might be interested to know that the 4.0.6 incarnation of the > extension had a problem with segfaulting when reading multiple entries from > a zip file. Your mileage may vary. > > Regards, > > Daniel Beckham > > ----- 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 > > > > > > > > > -- > > 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 > > > > >

« previous php.dev (#58126) next »