Doc #74214 [NEW]: Phar::extractTo() accepts null to skip $files
| From: | benjamin dot morel at gmail dot com | Date: | Mon, 06 Mar 2017 23:23:15 +0000 |
| Subject: | Doc #74214 [NEW]: Phar::extractTo() accepts null to skip $files | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-14486@lists.php.net to get a copy of this message | ||
From: benjamin dot morel at gmail dot com
Operating system: N/A
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Phar::extractTo() accepts null to skip $files
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 bug report at https://bugs.php.net/bug.php?id=74214&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74214&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74214&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74214&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74214&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74214&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74214&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74214&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74214&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74214&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74214&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74214&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74214&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74214&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74214&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74214&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74214&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74214&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74214&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74214&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74214&r=mysqlcfg