008.phpt 583 B

123456789101112131415161718192021
  1. --TEST--
  2. Phar::mapPhar truncated manifest (not enough for manifest length)
  3. --EXTENSIONS--
  4. phar
  5. --FILE--
  6. <?php
  7. $file = "<?php
  8. Phar::mapPhar('hio');
  9. __HALT_COMPILER(); ?>";
  10. $file .= pack('V', 500) . 'notenough';
  11. file_put_contents(__DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
  12. try {
  13. include __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
  14. } catch (Exception $e) {
  15. echo $e->getMessage();
  16. }
  17. ?>
  18. --CLEAN--
  19. <?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
  20. --EXPECTF--
  21. internal corruption of phar "%s" (truncated manifest header)