accept parameters by reference will now warn if a callback with reference
parameters is used. Examples include array_filter() and array_reduce().
This was already the case for most, but not all, functions previously.
+ . The HTTP stream wrapper as used by functions like file_get_contents()
+ now advertises HTTP/1.1 rather than HTTP/1.0 by default. This does not
+ change the behaviour of the client, but may cause servers to respond
+ differently. To retain the old behaviour, set the 'protocol_version'
+ stream context option, e.g.
+
+ $ctx = stream_context_create(['http' => ['protocol_version' => '1.0']]);
+ echo file_get_contents('http://example.org', false, $ctx);
- Sysvmsg:
. msg_get_queue() will now return an SysvMessageQueue object rather than a
smart_str_appends(&req_buf, "\r\n");
efree(protocol_version);
} else {
- smart_str_appends(&req_buf, " HTTP/1.0\r\n");
+ smart_str_appends(&req_buf, " HTTP/1.1\r\n");
}
if (context && (tmpzval = php_stream_context_get_option(context, "http", "header")) != NULL) {
$context = stream_context_create(array('http' => $context_options));
$responses = array(
- "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar2\r\n\r\n1",
- "data://text/plain,HTTP/1.0 301 Moved Permanently\r\nLocation: http://127.0.0.1:12342/foo/bar3\r\n\r\n",
- "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar4\r\n\r\n3",
- "data://text/plain,HTTP/1.0 200 OK\r\n\r\ndone.",
+ "data://text/plain,HTTP/1.1 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar2\r\n\r\n1",
+ "data://text/plain,HTTP/1.1 301 Moved Permanently\r\nLocation: http://127.0.0.1:12342/foo/bar3\r\n\r\n",
+ "data://text/plain,HTTP/1.1 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar4\r\n\r\n3",
+ "data://text/plain,HTTP/1.1 200 OK\r\n\r\ndone.",
);
$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
resource(%d) of type (stream)
array(7) {
[0]=>
- string(30) "HTTP/1.0 302 Moved Temporarily"
+ string(30) "HTTP/1.1 302 Moved Temporarily"
[1]=>
string(41) "Location: http://127.0.0.1:12342/foo/bar2"
[2]=>
- string(30) "HTTP/1.0 301 Moved Permanently"
+ string(30) "HTTP/1.1 301 Moved Permanently"
[3]=>
string(41) "Location: http://127.0.0.1:12342/foo/bar3"
[4]=>
- string(30) "HTTP/1.0 302 Moved Temporarily"
+ string(30) "HTTP/1.1 302 Moved Temporarily"
[5]=>
string(41) "Location: http://127.0.0.1:12342/foo/bar4"
[6]=>
- string(15) "HTTP/1.0 200 OK"
+ string(15) "HTTP/1.1 200 OK"
}
string(5) "done."
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
-GET /foo/bar2 HTTP/1.0
+GET /foo/bar2 HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
-GET /foo/bar3 HTTP/1.0
+GET /foo/bar3 HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
-GET /foo/bar4 HTTP/1.0
+GET /foo/bar4 HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
Warning: fopen(http://127.0.0.1:12342/foo/bar): Failed to open stream: Redirection limit reached, aborting in %s
bool(false)
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
-GET /foo/bar2 HTTP/1.0
+GET /foo/bar2 HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
Warning: fopen(http://127.0.0.1:12342/foo/bar): Failed to open stream: Redirection limit reached, aborting in %s
bool(false)
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
Warning: fopen(http://127.0.0.1:12342/foo/bar): Failed to open stream: Redirection limit reached, aborting in %s
bool(false)
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
resource(%d) of type (stream)
array(2) {
[0]=>
- string(30) "HTTP/1.0 302 Moved Temporarily"
+ string(30) "HTTP/1.1 302 Moved Temporarily"
[1]=>
string(41) "Location: http://127.0.0.1:12342/foo/bar2"
}
string(1) "1"
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
resource(%d) of type (stream)
array(2) {
[0]=>
- string(30) "HTTP/1.0 302 Moved Temporarily"
+ string(30) "HTTP/1.1 302 Moved Temporarily"
[1]=>
string(41) "Location: http://127.0.0.1:12342/foo/bar2"
}
string(1) "1"
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
resource(%d) of type (stream)
array(4) {
[0]=>
- string(30) "HTTP/1.0 302 Moved Temporarily"
+ string(30) "HTTP/1.1 302 Moved Temporarily"
[1]=>
string(41) "Location: http://127.0.0.1:12342/foo/bar2"
[2]=>
- string(30) "HTTP/1.0 301 Moved Permanently"
+ string(30) "HTTP/1.1 301 Moved Permanently"
[3]=>
string(41) "Location: http://127.0.0.1:12342/foo/bar3"
}
string(0) ""
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
-GET /foo/bar2 HTTP/1.0
+GET /foo/bar2 HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
$context = stream_context_create(array('http' => $context_options));
$responses = array(
- "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+ "data://text/plain,HTTP/1.1 200 OK\r\n\r\n",
);
$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
?>
--EXPECTF--
-- Test: requests with 'header' as array --
-string(%d) "POST / HTTP/1.0
+string(%d) "POST / HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
Content-Length: 4
ohai"
-- Test: requests with 'header' as string --
-string(%d) "POST / HTTP/1.0
+string(%d) "POST / HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
Content-Length: 4
function do_test() {
$responses = array(
- "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+ "data://text/plain,HTTP/1.1 200 OK\r\n\r\n",
);
$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
?>
--EXPECTF--
-- Test: leave default --
-string(%d) "GET / HTTP/1.0
+string(%d) "GET / HTTP/1.1
From: teste@teste.pt
Host: 127.0.0.1:12342
Connection: close
"
-- Test: after ini_set --
-string(%d) "GET / HTTP/1.0
+string(%d) "GET / HTTP/1.1
From: junk@junk.com
Host: 127.0.0.1:12342
Connection: close
?>
Done
--EXPECT--
-POST / HTTP/1.0
+POST / HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
Content-type: text/plain
-GET /foo HTTP/1.0
+GET /foo HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
-POST / HTTP/1.0
+POST / HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
Content-type: text/plain
-GET /foo HTTP/1.0
+GET /foo HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
-POST / HTTP/1.0
+POST / HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
Content-type: text/plain
Third:
-GET /foo HTTP/1.0
+GET /foo HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
Third:
-POST / HTTP/1.0
+POST / HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
Content-type:text/plain
Second:2
-GET /foo HTTP/1.0
+GET /foo HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
-POST / HTTP/1.0
+POST / HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
Content-type:text/plain
Second:2
-GET /foo HTTP/1.0
+GET /foo HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
-POST / HTTP/1.0
+POST / HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
Third:
-GET /foo HTTP/1.0
+GET /foo HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
First:1
?>
Done
--EXPECT--
-POST / HTTP/1.0
+POST / HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
-GET /foo HTTP/1.0
+GET /foo HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
-POST / HTTP/1.0
+POST / HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
require 'server.inc';
$responses = array(
- "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+ "data://text/plain,HTTP/1.1 200 OK\r\n\r\n",
);
$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
?>
--EXPECT--
-GET / HTTP/1.0
+GET / HTTP/1.1
Connection: close
RandomHeader: localhost:8080
Cookie: foo=bar
require 'server.inc';
$responses = array(
- "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+ "data://text/plain,HTTP/1.1 200 OK\r\n\r\n",
);
$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
?>
--EXPECT--
-GET / HTTP/1.0
+GET / HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
RandomHeader: host:8080
$context = stream_context_create(array('http' => $context_options));
$responses = array(
- "data://text/plain,HTTP/1.0 200 Ok\r\nX-Foo: bar\r\n\r\n1",
- "data://text/plain,HTTP/1.0 404 Not found\r\nX-bar: baz\r\n\r\n2",
+ "data://text/plain,HTTP/1.1 200 Ok\r\nX-Foo: bar\r\n\r\n1",
+ "data://text/plain,HTTP/1.1 404 Not found\r\nX-bar: baz\r\n\r\n2",
);
$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
resource(%d) of type (stream)
array(2) {
[0]=>
- string(15) "HTTP/1.0 200 Ok"
+ string(15) "HTTP/1.1 200 Ok"
[1]=>
string(10) "X-Foo: bar"
}
string(1) "1"
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
"
-Warning: fopen(http://127.0.0.1:12342/foo/bar): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not found
+Warning: fopen(http://127.0.0.1:12342/foo/bar): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not found
in %s on line %d
bool(false)
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
resource(%d) of type (stream)
array(2) {
[0]=>
- string(15) "HTTP/1.0 200 Ok"
+ string(15) "HTTP/1.1 200 Ok"
[1]=>
string(10) "X-Foo: bar"
}
string(1) "1"
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
resource(%d) of type (stream)
array(2) {
[0]=>
- string(22) "HTTP/1.0 404 Not found"
+ string(22) "HTTP/1.1 404 Not found"
[1]=>
string(10) "X-bar: baz"
}
string(1) "2"
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
resource(%d) of type (stream)
array(2) {
[0]=>
- string(15) "HTTP/1.0 200 Ok"
+ string(15) "HTTP/1.1 200 Ok"
[1]=>
string(10) "X-Foo: bar"
}
string(1) "1"
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
resource(%d) of type (stream)
array(2) {
[0]=>
- string(22) "HTTP/1.0 404 Not found"
+ string(22) "HTTP/1.1 404 Not found"
[1]=>
string(10) "X-bar: baz"
}
string(1) "2"
-string(%d) "GET /foo/bar HTTP/1.0
+string(%d) "GET /foo/bar HTTP/1.1
Host: 127.0.0.1:12342
Connection: close
}
?>
--EXPECTF--
-Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
+Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.1 501 Not Implemented
in %s on line %d
-Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
+Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.1 501 Not Implemented
in %s on line %d
-Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
+Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.1 501 Not Implemented
in %s on line %d
echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/..%5CCREDITS");
?>
--EXPECTF--
-Warning: file_get_contents(http://%s/..\CREDITS): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+Warning: file_get_contents(http://%s/..\CREDITS): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in %sbug70264.php on line %d
-Warning: file_get_contents(http://%s/..%5CCREDITS): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+Warning: file_get_contents(http://%s/..%5CCREDITS): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in %sbug70264.php on line %d