|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mark at dynom dot nl
New email:
PHP Version: OS:


 [2008-11-05 10:48 UTC] mark at dynom dot nl
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 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->extractTo($destination, $entries);


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 = '' }


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-23 07:49 UTC]
-Status: Open +Status: Not a bug
 [2013-10-23 07:49 UTC]
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

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-2020 The PHP Group
All rights reserved.
Last updated: Fri Jul 10 03:01:26 2020 UTC