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
15list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
16$port = intval($port)?:80;
17
18$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
19if (!$fp) {
20  die("connect failed");
21}
22
23if(fwrite($fp, <<<HEADER
24GET /foo/bar HTTP/1.1
25Host: {$host}
26
27
28HEADER
29)) {
30	while (!feof($fp)) {
31		echo fgets($fp);
32	}
33}
34
35fclose($fp);
36
37$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
38if (!$fp) {
39  die("connect failed");
40}
41
42
43if(fwrite($fp, <<<HEADER
44GET /foo/bar/ HTTP/1.0
45Host: {$host}
46
47
48HEADER
49)) {
50	while (!feof($fp)) {
51		echo fgets($fp);
52	}
53}
54
55fclose($fp);
56
57$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
58if (!$fp) {
59  die("connect failed");
60}
61
62
63if(fwrite($fp, <<<HEADER
64GET /foo/bar.js HTTP/1.0
65Host: {$host}
66
67
68HEADER
69)) {
70	while (!feof($fp)) {
71		echo fgets($fp);
72		break;
73	}
74}
75
76fclose($fp);
77?>
78--EXPECTF--
79HTTP/1.1 200 OK
80Host: %s
81Connection: close
82X-Powered-By: PHP/%s
83Content-type: text/html; charset=UTF-8
84
85string(8) "/foo/bar"
86HTTP/1.0 200 OK
87Host: %s
88Connection: close
89X-Powered-By: PHP/%s
90Content-type: text/html; charset=UTF-8
91
92string(9) "/foo/bar/"
93HTTP/1.0 404 Not Found
94