PHP  
 PHP_7_1
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/curl/tests/curl_file_upload.phpt ('CURL file uploading')

Script

1: <?php
2:
3:
function testcurl($ch$name$mime ''$postname '')
4: {
5:     if(!empty(
$postname)) {
6:         
$file = new CurlFile($name$mime$postname);
7:     } else if(!empty(
$mime)) {
8:         
$file = new CurlFile($name$mime);
9:     } else {
10:         
$file = new CurlFile($name);
11:     }
12:     
curl_setopt($chCURLOPT_POSTFIELDS, array("file" => $file));
13:     
var_dump(curl_exec($ch));
14: }
15:
16: include 
'server.inc';
17:
$host curl_cli_server_start();
18:
$ch curl_init();
19:
curl_setopt($chCURLOPT_URL"{$host}/get.php?test=file");
20:
curl_setopt($chCURLOPT_RETURNTRANSFER1);
21:
22:
testcurl($ch__DIR__ '/curl_testdata1.txt');
23:
testcurl($ch__DIR__ '/curl_testdata1.txt''text/plain');
24:
testcurl($ch__DIR__ '/curl_testdata1.txt''''foo.txt');
25:
testcurl($ch__DIR__ '/curl_testdata1.txt''text/plain''foo.txt');
26:
27:
$file = new CurlFile(__DIR__ '/curl_testdata1.txt');
28:
$file->setMimeType('text/plain');
29:
var_dump($file->getMimeType());
30:
var_dump($file->getFilename());
31:
curl_setopt($chCURLOPT_POSTFIELDS, array("file" => $file));
32:
var_dump(curl_exec($ch));
33:
34:
$file curl_file_create(__DIR__ '/curl_testdata1.txt');
35:
$file->setPostFilename('foo.txt');
36:
var_dump($file->getPostFilename());
37:
curl_setopt($chCURLOPT_POSTFIELDS, array("file" => $file));
38:
var_dump(curl_exec($ch));
39:
40:
curl_setopt($chCURLOPT_SAFE_UPLOAD0);
41:
$params = array('file' => '@' __DIR__ '/curl_testdata1.txt');
42:
curl_setopt($chCURLOPT_POSTFIELDS$params);
43:
var_dump(curl_exec($ch));
44:
45:
curl_setopt($chCURLOPT_SAFE_UPLOADtrue);
46:
$params = array('file' => '@' __DIR__ '/curl_testdata1.txt');
47:
curl_setopt($chCURLOPT_POSTFIELDS$params);
48:
var_dump(curl_exec($ch));
49:
50:
curl_setopt($chCURLOPT_URL"{$host}/get.php?test=post");
51:
$params = array('file' => '@' __DIR__ '/curl_testdata1.txt');
52:
curl_setopt($chCURLOPT_POSTFIELDS$params);
53:
var_dump(curl_exec($ch));
54:
55:
curl_close($ch);
56:
?>
57:

Expected

string(%d) "curl_testdata1.txt|application/octet-stream"
string(%d) "curl_testdata1.txt|text/plain"
string(%d) "foo.txt|application/octet-stream"
string(%d) "foo.txt|text/plain"
string(%d) "text/plain"
string(%d) "%s/curl_testdata1.txt"
string(%d) "curl_testdata1.txt|text/plain"
string(%d) "foo.txt"
string(%d) "foo.txt|application/octet-stream"

Warning: curl_setopt(): Disabling safe uploads is no longer supported in %s on line %d
string(0) ""
string(0) ""
string(%d) "array(1) {
  ["file"]=>
  string(%d) "@%s/curl_testdata1.txt"
}
"

Output

string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /responder/get.php was not found on this server.</p>
</body></html>
"
string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /responder/get.php was not found on this server.</p>
</body></html>
"
string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /responder/get.php was not found on this server.</p>
</body></html>
"
string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /responder/get.php was not found on this server.</p>
</body></html>
"
string(10) "text/plain"
string(55) "/var/php_gcov/PHP_7_1/ext/curl/tests/curl_testdata1.txt"
string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /responder/get.php was not found on this server.</p>
</body></html>
"
string(7) "foo.txt"
string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /responder/get.php was not found on this server.</p>
</body></html>
"

Warning: curl_setopt(): Disabling safe uploads is no longer supported in /var/php_gcov/PHP_7_1/ext/curl/tests/curl_file_upload.php on line 40
string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /responder/get.php was not found on this server.</p>
</body></html>
"
string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /responder/get.php was not found on this server.</p>
</body></html>
"
string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /responder/get.php was not found on this server.</p>
</body></html>
"

Diff

001+ string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
002+ <html><head>
003+ <title>404 Not Found</title>
004+ </head><body>
005+ <h1>Not Found</h1>
006+ <p>The requested URL /responder/get.php was not found on this server.</p>
007+ </body></html>
008+ "
009+ string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
010+ <html><head>
011+ <title>404 Not Found</title>
012+ </head><body>
013+ <h1>Not Found</h1>
014+ <p>The requested URL /responder/get.php was not found on this server.</p>
015+ </body></html>
016+ "
017+ string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
018+ <html><head>
019+ <title>404 Not Found</title>
020+ </head><body>
021+ <h1>Not Found</h1>
022+ <p>The requested URL /responder/get.php was not found on this server.</p>
023+ </body></html>
024+ "
025+ string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
026+ <html><head>
027+ <title>404 Not Found</title>
028+ </head><body>
029+ <h1>Not Found</h1>
030+ <p>The requested URL /responder/get.php was not found on this server.</p>
031+ </body></html>
001- string(%d) "curl_testdata1.txt|application/octet-stream"
002- string(%d) "curl_testdata1.txt|text/plain"
003- string(%d) "foo.txt|application/octet-stream"
004- string(%d) "foo.txt|text/plain"
005- string(%d) "text/plain"
006- string(%d) "%s/curl_testdata1.txt"
007- string(%d) "curl_testdata1.txt|text/plain"
008- string(%d) "foo.txt"
009- string(%d) "foo.txt|application/octet-stream"
010- 
011- Warning: curl_setopt(): Disabling safe uploads is no longer supported in %s on line %d
012- string(0) ""
013- string(0) ""
014- string(%d) "array(1) {
015-   ["file"]=>
016-   string(%d) "@%s/curl_testdata1.txt"
017- }
033+ string(10) "text/plain"
034+ string(55) "/var/php_gcov/PHP_7_1/ext/curl/tests/curl_testdata1.txt"
035+ string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
036+ <html><head>
037+ <title>404 Not Found</title>
038+ </head><body>
039+ <h1>Not Found</h1>
040+ <p>The requested URL /responder/get.php was not found on this server.</p>
041+ </body></html>
042+ "
043+ string(7) "foo.txt"
044+ string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
045+ <html><head>
046+ <title>404 Not Found</title>
047+ </head><body>
048+ <h1>Not Found</h1>
049+ <p>The requested URL /responder/get.php was not found on this server.</p>
050+ </body></html>
051+ "
052+ 
053+ Warning: curl_setopt(): Disabling safe uploads is no longer supported in /var/php_gcov/PHP_7_1/ext/curl/tests/curl_file_upload.php on line 40
054+ string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
055+ <html><head>
056+ <title>404 Not Found</title>
057+ </head><body>
058+ <h1>Not Found</h1>
059+ <p>The requested URL /responder/get.php was not found on this server.</p>
060+ </body></html>
061+ "
062+ string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
063+ <html><head>
064+ <title>404 Not Found</title>
065+ </head><body>
066+ <h1>Not Found</h1>
067+ <p>The requested URL /responder/get.php was not found on this server.</p>
068+ </body></html>
069+ "
070+ string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
071+ <html><head>
072+ <title>404 Not Found</title>
073+ </head><body>
074+ <h1>Not Found</h1>
075+ <p>The requested URL /responder/get.php was not found on this server.</p>
076+ </body></html>
077+ "

 

Generated at Fri, 15 Mar 2019 21:51:14 +0000 (7 days ago)

Copyright © 2005-2019 The PHP Group
All rights reserved.