summaryrefslogtreecommitdiff
path: root/sapi/cgi/tests/apache_response_headers.phpt
blob: bb8b3032ad6859e98b4c8b330c25a2ba64150eb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
apache_response_headers()
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php
include "include.inc";

$php = get_cgi_path();
reset_env_vars();

$test_file = __DIR__ . DIRECTORY_SEPARATOR ."apache_response_headers.test.php";

$code  = '<?php';
$code .= '
header( "X-Robots-Tag : noindex,nofollow,noarchive" );
header( "Content-type: text/html; charset=UTF-8" );
header( "Bad-header" );
header( " : " );
header( ":" );
flush();

var_dump( apache_response_headers() );
?>
';

file_put_contents( $test_file, $code );

passthru( "$php -n -q " . escapeshellarg( $test_file ) );

?>
--CLEAN--
<?php
@unlink( __DIR__ . DIRECTORY_SEPARATOR ."apache_response_headers.test.php" );
?>
--EXPECTF--
array(3) {
  ["X-Powered-By"]=>
  string(%d) "PHP/%s"
  ["X-Robots-Tag"]=>
  string(26) "noindex,nofollow,noarchive"
  ["Content-type"]=>
  string(24) "text/html; charset=UTF-8"
}