issue0115.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. ISSUE #115 (path issue when using phar)
  3. --INI--
  4. opcache.enable=1
  5. opcache.enable_cli=1
  6. phar.readonly=0
  7. --EXTENSIONS--
  8. opcache
  9. phar
  10. --CONFLICTS--
  11. server
  12. --FILE--
  13. <?php
  14. $stub = '<?php
  15. Phar::interceptFileFuncs();
  16. require "phar://this/index.php";
  17. __HALT_COMPILER(); ?>';
  18. $p = new Phar(__DIR__ . '/issue0115_1.phar.php', 0, 'this');
  19. $p['index.php'] = '<?php
  20. echo "Hello from Index 1.\n";
  21. require_once "phar://this/hello.php";
  22. ';
  23. $p['hello.php'] = "Hello World 1!\n";
  24. $p->setStub($stub);
  25. unset($p);
  26. $p = new Phar(__DIR__ . '/issue0115_2.phar.php', 0, 'this');
  27. $p['index.php'] = '<?php
  28. echo "Hello from Index 2.\n";
  29. require_once "phar://this/hello.php";
  30. ';
  31. $p['hello.php'] = "Hello World 2!\n";
  32. $p->setStub($stub);
  33. unset($p);
  34. include "php_cli_server.inc";
  35. php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d extension=phar.'.PHP_SHLIB_SUFFIX);
  36. echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_1.phar.php');
  37. echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_2.phar.php');
  38. ?>
  39. --CLEAN--
  40. <?php
  41. @unlink(__DIR__ . '/issue0115_1.phar.php');
  42. @unlink(__DIR__ . '/issue0115_2.phar.php');
  43. ?>
  44. --EXPECT--
  45. Hello from Index 1.
  46. Hello World 1!
  47. Hello from Index 2.
  48. Hello World 2!