Test Failure Report for sapi/cli/tests/php_cli_server_005.phpt ('Post a file')
Script
1:
<?php 2: include "php_cli_server.inc"; 3: php_cli_server_start('var_dump($_FILES);'); 4: 5: list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); 6: $port = intval($port)?:80; 7: 8: $fp = fsockopen($host, $port, $errno, $errstr, 0.5); 9: if (!$fp) { 10: die("connect failed"); 11: } 12: 13: $post_data = <<<POST 14: -----------------------------114782935826962 15: Content-Disposition: form-data; name="userfile"; filename="laruence.txt" 16: Content-Type: text/plain 17: 18: I am not sure about this. 19: 20: -----------------------------114782935826962-- 21: 22: 23: POST; 24: 25: $post_len = strlen($post_data); 26: 27: if(fwrite($fp, <<<HEADER 28: POST / HTTP/1.1 29: Host: {$host} 30: Content-Type: multipart/form-data; boundary=---------------------------114782935826962 31: Content-Length: {$post_len} 32: 33: 34: {$post_data} 35: HEADER 36: )) { 37: while (!feof($fp)) { 38: echo fgets($fp); 39: } 40: } 41: 42: ?> 43:
Expected
HTTP/1.1 200 OK
Host: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html
array(1) {
["userfile"]=>
array(5) {
["name"]=>
string(12) "laruence.txt"
["type"]=>
string(10) "text/plain"
["tmp_name"]=>
string(%d) "%s"
["error"]=>
int(0)
["size"]=>
int(26)
}
}
Output
Warning: fsockopen(): unable to connect to localhost:8964 (Connection refused) in /var/php_gcov/PHP_5_5/sapi/cli/tests/php_cli_server_005.php on line 8
connect failed
Diff
001+ Warning: fsockopen(): unable to connect to localhost:8964 (Connection refused) in /var/php_gcov/PHP_5_5/sapi/cli/tests/php_cli_server_005.php on line 8
002+ connect failed
001- HTTP/1.1 200 OK
002- Host: %s
003- Connection: close
004- X-Powered-By: PHP/%s
005- Content-type: text/html
006-
007- array(1) {
008- ["userfile"]=>
009- array(5) {
010- ["name"]=>
011- string(12) "laruence.txt"
012- ["type"]=>
013- string(10) "text/plain"
014- ["tmp_name"]=>
015- string(%d) "%s"
016- ["error"]=>
017- int(0)
018- ["size"]=>
019- int(26)
020- }
021- }
Generated at Wed, 15 May 2013 22:03:26 +0000 (7 days ago)
|