1--TEST-- 2ZipArchive::*ExternalAttributes*() function 3--SKIPIF-- 4<?php 5/* $Id$ */ 6if (!extension_loaded('zip')) die('skip'); 7?> 8--FILE-- 9<?php 10 11$name = __DIR__ . '/withattr.zip'; 12 13echo "== Set\n"; 14$zip = new ZipArchive; 15$r = $zip->open($name, ZIPARCHIVE::CREATE); 16$zip->addFromString('foo.txt', 'foo'); 17$zip->addFromString('bar.txt', 'bar'); 18var_dump($zip->setExternalAttributesName('foo.txt', ZipArchive::OPSYS_UNIX, 123)); 19$id = $zip->locateName('bar.txt'); 20var_dump($zip->setExternalAttributesIndex($id, ZipArchive::OPSYS_VFAT, 234)); 21$zip->close(); 22 23echo "== Get\n"; 24$r = $zip->open($name); 25var_dump($zip->getExternalAttributesName('foo.txt', $a, $b), $a, $b); 26$id = $zip->locateName('bar.txt'); 27var_dump($zip->getExternalAttributesIndex($id, $a, $b), $a, $b); 28 29echo "== Set\n"; 30var_dump($zip->setExternalAttributesName('foo.txt', ZipArchive::OPSYS_DOS, 345)); 31var_dump($zip->setExternalAttributesIndex($id, ZipArchive::OPSYS_AMIGA, 456)); 32echo "== Get changed\n"; 33var_dump($zip->getExternalAttributesName('foo.txt', $a, $b), $a, $b); 34var_dump($zip->getExternalAttributesIndex($id, $a, $b), $a, $b); 35echo "== Get unchanged\n"; 36var_dump($zip->getExternalAttributesName('foo.txt', $a, $b, ZipArchive::FL_UNCHANGED), $a, $b); 37var_dump($zip->getExternalAttributesIndex($id, $a, $b, ZipArchive::FL_UNCHANGED), $a, $b); 38 39$zip->close(); 40?> 41== Done 42--CLEAN-- 43<?php 44$name = __DIR__ . '/withattr.zip'; 45@unlink($name); 46?> 47--EXPECTF-- 48== Set 49bool(true) 50bool(true) 51== Get 52bool(true) 53int(3) 54int(123) 55bool(true) 56int(14) 57int(234) 58== Set 59bool(true) 60bool(true) 61== Get changed 62bool(true) 63int(0) 64int(345) 65bool(true) 66int(1) 67int(456) 68== Get unchanged 69bool(true) 70int(3) 71int(123) 72bool(true) 73int(14) 74int(234) 75== Done 76