--TEST-- GH-11274 (POST/PATCH request via file_get_contents + stream_context_create switches to GET after a HTTP 308 redirect) --INI-- allow_url_fopen=1 --CONFLICTS-- server --FILE-- ['method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query(['hello' => 'world'])]])); echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/test$suffix", false, stream_context_create(['http' => ['method' => 'PATCH', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query(['hello' => 'world'])]])); echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/test/$suffix", false, stream_context_create(['http' => ['method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query(['hello' => 'world'])]])); echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/test/$suffix", false, stream_context_create(['http' => ['method' => 'PATCH', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query(['hello' => 'world'])]])); } ?> --EXPECT-- -- Testing unredirected request -- method: POST; body: hello=world method: PATCH; body: hello=world method: POST; body: hello=world method: PATCH; body: hello=world -- Testing redirect status code 301 -- method: GET; body: method: GET; body: method: GET; body: method: GET; body: -- Testing redirect status code 302 -- method: GET; body: method: GET; body: method: GET; body: method: GET; body: -- Testing redirect status code 307 -- method: POST; body: hello=world method: PATCH; body: hello=world method: POST; body: hello=world method: PATCH; body: hello=world -- Testing redirect status code 308 -- method: POST; body: hello=world method: PATCH; body: hello=world method: POST; body: hello=world method: PATCH; body: hello=world