File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / sapi / cli / tests / php_cli_server_012.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:32:13 2013 UTC (11 years ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17, HEAD
5.4.17

    1: --TEST--
    2: Bug #60159 (Router returns false, but POST is not passed to requested resource)
    3: --SKIPIF--
    4: <?php
    5: include "skipif.inc"; 
    6: ?>
    7: --FILE--
    8: <?php
    9: include "php_cli_server.inc";
   10: php_cli_server_start('print_r($_REQUEST); $_REQUEST["foo"] = "bar"; return FALSE;');
   11: $doc_root = __DIR__;
   12: file_put_contents($doc_root . '/request.php', '<?php print_r($_REQUEST); ?>');
   13: 
   14: list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
   15: $port = intval($port)?:80;
   16: 
   17: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
   18: if (!$fp) {
   19:   die("connect failed");
   20: }
   21: 
   22: if(fwrite($fp, <<<HEADER
   23: POST /request.php HTTP/1.1
   24: Host: {$host}
   25: Content-Type: application/x-www-form-urlencoded
   26: Content-Length: 3
   27: 
   28: a=b
   29: HEADER
   30: )) {
   31: 	while (!feof($fp)) {
   32: 		echo fgets($fp);
   33: 	}
   34: }
   35: 
   36: fclose($fp);
   37: @unlink($doc_root . '/request.php');
   38: 
   39: ?>
   40: --EXPECTF--
   41: HTTP/1.1 200 OK
   42: Host: %s
   43: Connection: close
   44: X-Powered-By: PHP/%s
   45: Content-type: text/html
   46: 
   47: Array
   48: (
   49:     [a] => b
   50: )
   51: Array
   52: (
   53:     [a] => b
   54:     [foo] => bar
   55: )

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>