bug79912.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Bug #79912 (Phar::decompressFiles not working)
  3. --EXTENSIONS--
  4. phar
  5. zlib
  6. --INI--
  7. phar.readonly=0
  8. --FILE--
  9. <?php
  10. $phar = new Phar(__DIR__ . "/bug79912.phar");
  11. $phar->addFromString("test.txt", "This is a test file.This is a test file.This is a test file.");
  12. $file = $phar["test.txt"];
  13. var_dump($file->compress(Phar::GZ)); //true (success)
  14. var_dump($file->getContent());
  15. var_dump($file->isCompressed()); //true (the file is compressed)
  16. var_dump($phar->decompressFiles()); //true (success)
  17. var_dump($file->isCompressed()); //false (the file should not be compressed anymore)
  18. var_dump($phar->extractTo(__DIR__ . "/bug79912")); //true
  19. var_dump(file_get_contents(__DIR__ . "/bug79912/test.txt")); //the extracted file in the folder should be decompressed
  20. ?>
  21. --EXPECT--
  22. bool(true)
  23. string(60) "This is a test file.This is a test file.This is a test file."
  24. bool(true)
  25. bool(true)
  26. bool(false)
  27. bool(true)
  28. string(60) "This is a test file.This is a test file.This is a test file."
  29. --CLEAN--
  30. <?php
  31. @unlink(__DIR__ . "/bug79912/test.txt");
  32. @rmdir(__DIR__ . "/bug79912");
  33. @unlink(__DIR__ . "/bug79912.phar");
  34. ?>