1--TEST--
2Bug #55755 (SegFault when outputting header WWW-Authenticate)
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9include "php_cli_server.inc";
10php_cli_server_start('var_dump($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]);');
11
12$host = PHP_CLI_SERVER_HOSTNAME;
13$fp = php_cli_server_connect();
14
15if(fwrite($fp, <<<HEADER
16GET / HTTP/1.1
17Host: {$host}
18Authorization: Basic Zm9vOmJhcg==
19
20
21HEADER
22)) {
23    while (!feof($fp)) {
24        echo fgets($fp);
25    }
26}
27
28?>
29--EXPECTF--
30HTTP/1.1 200 OK
31Host: %s
32Date: %s
33Connection: close
34X-Powered-By: PHP/%s
35Content-type: text/html; charset=UTF-8
36
37string(3) "foo"
38string(3) "bar"
39