php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58407 extractTo second argument is not really optional
Submitted: 2008-11-05 10:48 UTC Modified: 2013-10-23 07:49 UTC
From: mark at dynom dot nl Assigned:
Status: Not a bug Package: zip (PECL)
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mark at dynom dot nl
New email:
PHP Version: OS:

 

 [2008-11-05 10:48 UTC] mark at dynom dot nl
Description:
------------
Currently the 'extractTo' method of the class 'ZipArchive' accepts two parameters, a destination and a entries parameter.

The entries parameter is allowed to be NULL. however when invoked like below, warnings are thrown about the optinal argument making it hard to extend ZipArchive in some points.


Extension Version => $Id: php_zip.c,v 1.1.2.43 2008/01/18 00:51:38 pajoye Exp $
Zip version => 1.8.11
Libzip version => 0.8.0-compatible


Reproduce code:
---------------
function funkyExtract($destination, $entries = NULL)
{
  $za = new ZipArchive;
  $za->open('fubar.zip');
  $za->extractTo($destination, $entries);
  $za->close();
}

funkyExtract('./');

Actual result:
--------------
PHP Warning:  ZipArchive::extractTo(): Invalid argument, expect string or array of strings in /tmp/ziparchive.php on line 7
PHP Stack trace:
PHP   1. {main}() /tmp/ziparchive.php:0
PHP   2. funkyExtract($destination = './', $entries = *uninitialized*) /tmp/ziparchive.php:11
PHP   3. ZipArchive->extractTo('./', NULL) /tmp/ziparchive.php:7

Warning: ZipArchive::extractTo(): Invalid argument, expect string or array of strings in /tmp/ziparchive.php on line 7

Call Stack:
    0.0009      50052   1. {main}() /tmp/ziparchive.php:0
    0.0010      50100   2. funkyExtract(string(2), ???) /tmp/ziparchive.php:11
    0.0011      50540   3. ZipArchive->extractTo(string(2), null) /tmp/ziparchive.php:7


Variables in local scope (#2):
  $entries = NULL
  $destination = './'
  $za = class ZipArchive { public $status = 0; public $statusSys = 0; public $numFiles = 1; public $filename = ''; public $comment = '' }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-23 07:49 UTC] remi@php.net
-Status: Open +Status: Not a bug
 [2013-10-23 07:49 UTC] remi@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 13:01:29 2024 UTC