Fix code sample

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@339282 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Remi Collet 2016-06-02 12:48:44 +00:00
parent 65e6a11592
commit 244efca786
2 changed files with 2 additions and 2 deletions

View file

@ -83,7 +83,7 @@ if ($zip->open('test.zip') === TRUE) {
if ($zip->extractTo('.', $s['name'])) {
if ($zip->getExternalAttributesIndex($idx, $opsys, $attr)
&& $opsys==ZipArchive::OPSYS_UNIX) {
chmod($s['name'], ($attr & 07777));
chmod($s['name'], ($attr >> 16) & 0777);
}
}
}

View file

@ -81,7 +81,7 @@ $zip = new ZipArchive();
$stat = stat($filename='test.txt');
if (is_array($stat) && $zip->open('test.zip', ZipArchive::CREATE) === TRUE) {
$zip->addFile($filename);
$zip->setExternalAttributesName($filename, ZipArchive::OPSYS_UNIX, $stat['mode']);
$zip->setExternalAttributesName($filename, ZipArchive::OPSYS_UNIX, $stat['mode'] << 16);
$zip->close();
echo "Ok\n";
} else {