phar_commitwrite.phpt 881 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. Phar::setStub()/stopBuffering()
  3. --EXTENSIONS--
  4. phar
  5. --INI--
  6. phar.require_hash=0
  7. phar.readonly=0
  8. --FILE--
  9. <?php
  10. $p = new Phar(__DIR__ . '/phar_commitwrite.phar', 0, 'phar_commitwrite.phar');
  11. $p['file1.txt'] = 'hi';
  12. $p->stopBuffering();
  13. var_dump(strlen($p->getStub()));
  14. $p->setStub("<?php
  15. spl_autoload_register(function(\$class) {
  16. include 'phar://' . str_replace('_', '/', \$class);
  17. });
  18. Phar::mapPhar('phar_commitwrite.phar');
  19. include 'phar://phar_commitwrite.phar/startup.php';
  20. __HALT_COMPILER();
  21. ?>");
  22. var_dump($p->getStub());
  23. ?>
  24. --CLEAN--
  25. <?php
  26. unlink(__DIR__ . '/phar_commitwrite.phar');
  27. __HALT_COMPILER();
  28. ?>
  29. --EXPECTF--
  30. int(6641)
  31. string(%d) "<?php
  32. spl_autoload_register(function($class) {
  33. include 'phar://' . str_replace('_', '/', $class);
  34. });
  35. Phar::mapPhar('phar_commitwrite.phar');
  36. include 'phar://phar_commitwrite.phar/startup.php';
  37. __HALT_COMPILER(); ?>
  38. "