bug72035.phpt 892 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Bug #72035 php-cgi.exe fails to run scripts relative to drive root
  3. --SKIPIF--
  4. <?php
  5. if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test');
  6. $cgi = realpath(dirname(PHP_BINARY)) . DIRECTORY_SEPARATOR . "php-cgi.exe";
  7. if (!file_exists($cgi)) die('skip CGI binary not found');
  8. ?>
  9. --FILE--
  10. <?php
  11. $fl = __DIR__ . DIRECTORY_SEPARATOR . md5(uniqid()) . ".php";
  12. $fl = substr($fl, 2);
  13. $cgi = realpath(dirname(PHP_BINARY) . DIRECTORY_SEPARATOR . "php-cgi.exe");
  14. file_put_contents($fl, "<?php echo \"hello\", \"\n\"; ?>");
  15. $cmd = "$cgi -n -C $fl";
  16. /* Need to run CGI with the env reset. */
  17. $desc = array(0 => array("pipe", "r"));
  18. $proc = proc_open($cmd, $desc, $pipes, getcwd(), array());
  19. if (is_resource($proc)) {
  20. echo stream_get_contents($pipes[0]);
  21. proc_close($proc);
  22. }
  23. unlink($fl);
  24. ?>
  25. --EXPECTF--
  26. X-Powered-By: PHP/%s
  27. Content-type: text/html; charset=UTF-8
  28. hello