xref: /PHP-8.2/ext/standard/tests/http/bug78719.phpt (revision ac18dd0d)
1--TEST--
2Bug #78719 (http wrapper silently ignores long Location headers)
3--SKIPIF--
4<?php require 'server.inc'; http_server_skipif(); ?>
5--INI--
6allow_url_fopen=1
7--FILE--
8<?php
9require 'server.inc';
10
11$url = str_repeat('*', 2000);
12$responses = array(
13	"data://text/plain,HTTP/1.0 302 Ok\r\nLocation: $url\r\n\r\nBody",
14);
15['pid' => $pid, 'uri' => $uri] = http_server($responses);
16
17$context = stream_context_create(['http' => ['follow_location' => 0]]);
18$stream = fopen($uri, 'r', false, $context);
19var_dump(stream_get_contents($stream));
20var_dump(stream_get_meta_data($stream)['wrapper_data'][1] === "Location: $url");
21
22http_server_kill($pid);
23?>
24--EXPECT--
25string(4) "Body"
26bool(true)
27