1--TEST-- 2FR #67429 (CLI server is missing some new HTTP response codes) 3--SKIPIF-- 4<?php 5include "skipif.inc"; 6?> 7--FILE-- 8<?php 9include "php_cli_server.inc"; 10 11foreach ([308, 426] as $code) { 12 php_cli_server_start(<<<PHP 13http_response_code($code); 14PHP 15 ); 16 17 list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); 18 $port = intval($port)?:80; 19 20 $fp = fsockopen($host, $port, $errno, $errstr, 0.5); 21 if (!$fp) { 22 die("connect failed"); 23 } 24 25 if(fwrite($fp, <<<HEADER 26GET / HTTP/1.1 27 28 29HEADER 30 )) { 31 while (!feof($fp)) { 32 echo fgets($fp); 33 } 34 } 35 36 fclose($fp); 37} 38?> 39--EXPECTF-- 40HTTP/1.1 308 Permanent Redirect 41Connection: close 42X-Powered-By: %s 43Content-type: text/html 44 45HTTP/1.1 426 Upgrade Required 46Connection: close 47X-Powered-By: %s 48Content-type: text/html 49 50