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