PCLZIP_OPT_EXTRACT_DIR_RESTRICTION
PclZip can extract any file in any folder of a system. People may use this to upload a zip file and try to override a system file or any other file (password file, ...). The PCLZIP_OPT_EXTRACT_DIR_RESTRICTION gives the ability to forgive any directory transversal behavior.
The use of this option can also be convenient to limit simple errors in some scripts.Be aware that a better security is to use the directory restriction of PHP configuration.
The following example will reject the extraction of any file in the archive that are not in the "/var/www/data" folder.
$archive = new PclZip('test.zip');
$list = $archive->extract(PCLZIP_OPT_EXTRACT_DIR_RESTRICTION, "/var/www/data");
if ($list == 0) {
echo "ERROR : ".$archive->errorInfo(true);
}
| [Optional Arguments List] |




