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