1--TEST-- 2Rename entries 3--EXTENSIONS-- 4zip 5--FILE-- 6<?php 7$dirname = __DIR__ . '/'; 8include $dirname . 'utils.inc'; 9$file = $dirname . 'oo_rename.zip'; 10 11@unlink($file); 12 13$zip = new ZipArchive; 14if (!$zip->open($file, ZIPARCHIVE::CREATE)) { 15 exit('failed'); 16} 17 18$zip->addFromString('entry1.txt', 'entry #1'); 19$zip->addFromString('entry2.txt', 'entry #2'); 20$zip->addFromString('dir/entry2.txt', 'entry #2'); 21 22if (!$zip->status == ZIPARCHIVE::ER_OK) { 23 var_dump($zip); 24 echo "failed2\n"; 25} 26 27$zip->close(); 28 29if (!$zip->open($file)) { 30 exit('failed3'); 31} 32 33if (!verify_entries($zip, [ 34 "entry1.txt", 35 "entry2.txt", 36 "dir/entry2.txt" 37])) { 38 exit("failed4"); 39} else { 40 echo "OK\n"; 41} 42 43if (!$zip->renameIndex(0, 'ren_entry1.txt')) { 44 echo "failed index 0\n"; 45} 46 47if (!$zip->renameName('dir/entry2.txt', 'dir3/ren_entry2.txt')) { 48 echo "failed name dir/entry2.txt\n"; 49} 50 51if (!verify_entries($zip, [ 52 "ren_entry1.txt", 53 "entry2.txt", 54 "dir3/ren_entry2.txt" 55])) { 56 exit("failed5"); 57} else { 58 echo "OK\n"; 59} 60$zip->close(); 61 62@unlink($file); 63?> 64--EXPECT-- 65OK 66OK 67