[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-bugs
Subject:    [DOC-BUGS] Doc #74214 [Opn->Csd]: Phar::extractTo() accepts null to skip $files
From:       vrana () php ! net
Date:       2018-01-29 23:31:07
Message-ID: 201801292331.w0TNV7t3022846 () srgv2 ! php ! net
[Download RAW message or body]

Edit report at https://bugs.php.net/bug.php?id=74214&edit=1

 ID:                 74214
 Updated by:         vrana@php.net
 Reported by:        benjamin dot morel at gmail dot com
 Summary:            Phar::extractTo() accepts null to skip $files
-Status:             Open
+Status:             Closed
 Type:               Documentation Problem
 Package:            Documentation problem
 Operating System:   N/A
 PHP Version:        Irrelevant
-Assigned To:        
+Assigned To:        vrana
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2018-01-29 23:31:02] vrana@php.net

Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&revision=344088
Log: Document null files (bug #74214)

------------------------------------------------------------------------
[2017-03-06 23:23:14] benjamin dot morel at gmail dot com

Description:
------------
The documented signature of extractTo() is:

public bool Phar::extractTo ( string $pathto [, string|array $files [, bool \
$overwrite = false ]] )

Consider that I want to extract all files from a Phar archive to a directory, \
overwriting existing files; I need to skip the $files parameter to set $overwrite to \
true.

With $files accepting string|array, I tried an empty string:

$phar->extractTo('dir', '', true);

But this yields an exception:
PharException: Phar Error: attempted to extract non-existent file ""

I also tried an empty array:

$phar->extractTo('dir', [], true);

But it does not extract any file.

Actually, the only thing that works to actually skip the $files parameter is to pass \
a null value:

$phar->extractTo('dir', null, true);

So it would be nice to document the fact that $files can accept null as well.

Expected result:
----------------
public bool Phar::extractTo ( string $pathto [, string|array|null $files [, bool \
$overwrite = false ]] )

...

files

The name of a file or directory to extract, or an array of files/directories to \
extract, or null to skip the parameter

Actual result:
--------------
public bool Phar::extractTo ( string $pathto [, string|array $files [, bool \
$overwrite = false ]] )

...

files

The name of a file or directory to extract, or an array of files/directories to \
extract


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74214&edit=1

-- 
PHP Documentation Bugs Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic