bug7658.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --TEST--
  2. Bug #7658 (modify archive with general bit flag 3 set)
  3. --EXTENSIONS--
  4. zip
  5. --FILE--
  6. <?php
  7. $expect = array(
  8. "mimetype",
  9. "Configurations2/statusbar/",
  10. "Configurations2/accelerator/current.xml",
  11. "Configurations2/floater/",
  12. "Configurations2/popupmenu/",
  13. "Configurations2/progressbar/",
  14. "Configurations2/menubar/",
  15. "Configurations2/toolbar/",
  16. "Configurations2/images/Bitmaps/",
  17. "content.xml",
  18. "styles.xml",
  19. "meta.xml",
  20. "Thumbnails/thumbnail.png",
  21. "settings.xml",
  22. "META-INF/manifest.xml",
  23. );
  24. $dirname = __DIR__ . '/';
  25. include $dirname . 'utils.inc';
  26. $file = $dirname . '__tmp_bug7658.odt';
  27. $zip = new ZipArchive();
  28. copy($dirname . 'bug7658.odt', $file);
  29. if(!$zip->open($file)) {
  30. echo 'failed';
  31. }
  32. $zip->deleteName('content.xml');
  33. $zip->addFile($dirname . "bug7658.xml","content.xml");
  34. $zip->close();
  35. echo "\n";
  36. $zip->open($file);
  37. for($i=0; $i < $zip->numFiles; $i++) {
  38. $sb = $zip->statIndex($i);
  39. $found[] = $sb['name'];
  40. }
  41. $ar = array_diff($found, $expect);
  42. var_dump($ar);
  43. unset($zip);
  44. unlink($file);
  45. ?>
  46. --EXPECT--
  47. array(0) {
  48. }