PHP  
 PHP_7_3
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_CURLOPT_READDATA.phpt ('Test CURLOPT_READDATA without a callback function')

Script

1: <?php
2:
3:
include 'server.inc';
4:
$host curl_cli_server_start();
5:
// The URL to POST to
6:
$url $host '/get.php?test=post';
7:
8:
// Create a temporary file to read the data from
9:
$tempname tempnam(sys_get_temp_dir(), 'CURL_DATA');
10:
$datalen file_put_contents($tempname"hello=world&smurf=blue");
11:
12:
ob_start();
13:
14:
$ch curl_init($url);
15:
curl_setopt($chCURLOPT_URL$url);
16:
curl_setopt($chCURLOPT_POSTtrue);
17:
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
18:
curl_setopt($chCURLOPT_READDATAfopen($tempname'rb'));
19:
curl_setopt($chCURLOPT_HTTPHEADER, array('Expect:'"Content-Length: {$datalen}"));
20:
21: if (
false === $response curl_exec($ch)) {
22:     echo 
'Error #' curl_errno($ch) . ': ' curl_error($ch);
23: } else {
24:     echo 
$response;
25: }
26:
27:
curl_close($ch);
28:
29:
// Clean the temporary file
30:
@unlink($tempname);
31:

Expected

array(2) {
  ["hello"]=>
  string(5) "world"
  ["smurf"]=>
  string(4) "blue"
}

Output

<!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+ <!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>
001- array(2) {
002-   ["hello"]=>
003-   string(5) "world"
004-   ["smurf"]=>
005-   string(4) "blue"
006- }
007+ </body></html>

 

Generated at Thu, 14 Nov 2019 02:24:20 +0000 (11 hours ago)

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