1--TEST--
2PATH_INFO (relevant to #60112)
3--DESCRIPTION--
4After this fix(#60112), previously 404 request like "localhost/foo/bar"
5now could serve correctly with request_uri "index.php" and PATH_INFO "/foo/bar/"
6--SKIPIF--
7<?php
8include "skipif.inc";
9?>
10--FILE--
11<?php
12include "php_cli_server.inc";
13php_cli_server_start('var_dump($_SERVER["PATH_INFO"]);', null);
14
15$host = PHP_CLI_SERVER_HOSTNAME;
16$fp = php_cli_server_connect();
17
18if(fwrite($fp, <<<HEADER
19GET /foo/bar HTTP/1.1
20Host: {$host}
21
22
23HEADER
24)) {
25    while (!feof($fp)) {
26        echo fgets($fp);
27    }
28}
29
30fclose($fp);
31
32$fp = php_cli_server_connect();
33
34if(fwrite($fp, <<<HEADER
35GET /foo/bar/ HTTP/1.0
36Host: {$host}
37
38
39HEADER
40)) {
41    while (!feof($fp)) {
42        echo fgets($fp);
43    }
44}
45
46fclose($fp);
47
48$fp = php_cli_server_connect();
49
50if(fwrite($fp, <<<HEADER
51GET /foo/bar.js HTTP/1.0
52Host: {$host}
53
54
55HEADER
56)) {
57    while (!feof($fp)) {
58        echo fgets($fp);
59        break;
60    }
61}
62
63fclose($fp);
64?>
65--EXPECTF--
66HTTP/1.1 200 OK
67Host: %s
68Date: %s
69Connection: close
70X-Powered-By: PHP/%s
71Content-type: text/html; charset=UTF-8
72
73string(8) "/foo/bar"
74HTTP/1.0 200 OK
75Host: %s
76Date: %s
77Connection: close
78X-Powered-By: PHP/%s
79Content-type: text/html; charset=UTF-8
80
81string(9) "/foo/bar/"
82HTTP/1.0 404 Not Found
83