xref: /PHP-8.2/sapi/cli/tests/gh16137.phpt (revision 3d80d98a)
1--TEST--
2Bug GH-16137 duplicate *Forwarded* HTTP headers values.
3--INI--
4allow_url_fopen=1
5--SKIPIF--
6<?php
7include "skipif.inc";
8?>
9--FILE--
10<?php
11include "php_cli_server.inc";
12php_cli_server_start("echo \$_SERVER['HTTP_X_FORWARDED_FOR'];");
13$ctx = stream_context_create(array('http' => array (
14    'method' => 'POST',
15    'header' => array('x-forwarded-for: 127.0.0.1', 'x-forwarded-for: 192.168.1.254')
16)));
17var_dump(file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS, true, $ctx));
18?>
19--EXPECT--
20string(24) "127.0.0.1, 192.168.1.254"
21