|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-01-29 23:31 UTC] vrana@php.net
[2018-01-29 23:31 UTC] vrana@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: vrana
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 17:00:01 2025 UTC |
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