Doc #74214 [Opn->Csd]: Phar::extractTo() accepts null to skip $files

From: Date: Mon, 29 Jan 2018 23:31:07 +0000
Subject: Doc #74214 [Opn->Csd]: Phar::extractTo() accepts null to skip $files
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15389@lists.php.net to get a copy of this message
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

« previous php.doc.bugs (#15389) next »