bug71624.phpt 704 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Bug #61977 Test that -R properly sets argi and argn
  3. --SKIPIF--
  4. <?php
  5. include "skipif.inc";
  6. ?>
  7. --FILE--
  8. <?php
  9. $php = getenv('TEST_PHP_EXECUTABLE');
  10. $filename_txt = __DIR__ . DIRECTORY_SEPARATOR . "bug71624.test.txt";
  11. $txt = 'foo
  12. test
  13. hello
  14. ';
  15. file_put_contents($filename_txt, $txt);
  16. $test_args = ['$argi', '$argn'];
  17. foreach ($test_args as $test_arg) {
  18. if (substr(PHP_OS, 0, 3) == 'WIN') {
  19. var_dump(`type "$filename_txt" | "$php" -n -R "echo $test_arg . PHP_EOL;"`);
  20. } else {
  21. var_dump(`cat "$filename_txt" | "$php" -n -R 'echo $test_arg . PHP_EOL;'`);
  22. }
  23. }
  24. @unlink($filename_txt);
  25. echo "Done\n";
  26. ?>
  27. --EXPECT--
  28. string(6) "1
  29. 2
  30. 3
  31. "
  32. string(15) "foo
  33. test
  34. hello
  35. "
  36. Done