You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.2 KiB

  1. --TEST--
  2. Bug #60180 ($_SERVER["PHP_SELF"] incorrect)
  3. --SKIPIF--
  4. <?php
  5. include "skipif.inc";
  6. ?>
  7. --FILE--
  8. <?php
  9. include "php_cli_server.inc";
  10. php_cli_server_start('var_dump($_SERVER["PHP_SELF"], $_SERVER["SCRIPT_NAME"], $_SERVER["PATH_INFO"], $_SERVER["QUERY_STRING"]);', TRUE);
  11. list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
  12. $port = intval($port)?:80;
  13. $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
  14. if (!$fp) {
  15. die("connect failed");
  16. }
  17. if(fwrite($fp, <<<HEADER
  18. GET /foo/bar?foo=bar HTTP/1.1
  19. Host: {$host}
  20. HEADER
  21. )) {
  22. while (!feof($fp)) {
  23. echo fgets($fp);
  24. }
  25. }
  26. fclose($fp);
  27. $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
  28. if (!$fp) {
  29. die("connect failed");
  30. }
  31. if(fwrite($fp, <<<HEADER
  32. GET /index.php/foo/bar/?foo=bar HTTP/1.0
  33. Host: {$host}
  34. HEADER
  35. )) {
  36. while (!feof($fp)) {
  37. echo fgets($fp);
  38. }
  39. }
  40. fclose($fp);
  41. ?>
  42. --EXPECTF--
  43. HTTP/1.1 200 OK
  44. Host: %s
  45. Connection: closed
  46. X-Powered-By: PHP/%s
  47. Content-type: text/html
  48. string(18) "/index.php/foo/bar"
  49. string(10) "/index.php"
  50. string(8) "/foo/bar"
  51. string(7) "foo=bar"
  52. HTTP/1.0 200 OK
  53. Host: %s
  54. Connection: closed
  55. X-Powered-By: PHP/%s
  56. Content-type: text/html
  57. string(19) "/index.php/foo/bar/"
  58. string(10) "/index.php"
  59. string(9) "/foo/bar/"
  60. string(7) "foo=bar"