bug66606_2.phpt 758 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Bug #66606 (Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE) - POST request
  3. --INI--
  4. allow_url_fopen=1
  5. --SKIPIF--
  6. <?php
  7. include "skipif.inc";
  8. ?>
  9. --FILE--
  10. <?php
  11. include "php_cli_server.inc";
  12. php_cli_server_start('var_dump($_SERVER["CONTENT_TYPE"], $_SERVER["CONTENT_LENGTH"])');
  13. $host = PHP_CLI_SERVER_HOSTNAME;
  14. $fp = php_cli_server_connect();
  15. if (fwrite($fp, <<<HEADER
  16. POST /index.php HTTP/1.1
  17. Host: {$host}
  18. Content-Type: application/x-www-form-urlencoded
  19. Content-Length: 3
  20. a=b
  21. HEADER
  22. )) {
  23. while (!feof($fp)) {
  24. echo fgets($fp);
  25. }
  26. }
  27. fclose($fp);
  28. ?>
  29. --EXPECTF--
  30. HTTP/1.1 200 OK
  31. Host: %s
  32. Date: %s
  33. Connection: close
  34. X-Powered-By: PHP/%s
  35. Content-type: text/html; charset=UTF-8
  36. string(33) "application/x-www-form-urlencoded"
  37. string(1) "3"