xref: /PHP-8.2/ext/standard/tests/http/bug75981.phpt (revision 95f25837)
1--TEST--
2Bug #75981 (stack-buffer-overflow while parsing HTTP response)
3--INI--
4allow_url_fopen=1
5--SKIPIF--
6<?php require 'server.inc'; http_server_skipif(); ?>
7--FILE--
8<?php
9require 'server.inc';
10
11$options = [
12  'http' => [
13    'protocol_version' => '1.1',
14    'header' => 'Connection: Close'
15  ],
16];
17
18$ctx = stream_context_create($options);
19
20$responses = [
21    "data://text/plain,000000000100\xA\xA"
22];
23['pid' => $pid, 'uri' => $uri] = http_server($responses);
24
25echo @file_get_contents($uri, false, $ctx);
26
27http_server_kill($pid);
28
29?>
30DONE
31--EXPECT--
32DONE
33