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 <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Bug #11675 Updated: zzip_open() has a wrong arg count and
>     doesn't validate arg2 correctly
>
> ID: 11675
> Updated by: danbeck
> Reported By: [EMAIL PROTECTED]
> 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] [EMAIL PROTECTED]
> 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] [EMAIL PROTECTED]
> 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] [EMAIL PROTECTED]
> 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 <[EMAIL PROTECTED]>
PFFT! http://pfft.net



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to