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_setopt_array_basic.phpt ('curl_setopt_array() function - tests setting multiple cURL options with curl_setopt_array()')

Script

1: <?php
2:
/*
3:  * Prototype:     bool curl_setopt_array(resource $ch, array $options)
4:  * Description:   Sets multiple options for a cURL session.
5:  * Source:        ext/curl/interface.c
6:  * Documentation: http://wiki.php.net/qa/temp/ext/curl
7:  */
8:
9: // Figure out what handler to use
10:
include 'server.inc';
11:
$host curl_cli_server_start();
12: if (!empty(
$host)) {
13:     
// Use the set Environment variable
14:     
$url "{$host}/get.php?test=get";
15: } else {
16:     
// Create a temporary file for the test
17:     
$tempname tempnam(sys_get_temp_dir(), 'CURL_HANDLE');
18:     
$url 'file://'$tempname;
19:     
// add the test data to the file
20:     
file_put_contents($tempname"Hello World!\nHello World!");
21: }
22:
23:
// Start the test
24:
echo '== Starting test curl_setopt_array($ch, $options); ==' "\n";
25:
26:
// curl handler
27:
$ch curl_init();
28:
29:
// options for the curl handler
30:
$options = array (
31:     
CURLOPT_URL => $url,
32:     
CURLOPT_RETURNTRANSFER => 1
33:
);
34:
35:
ob_start(); // start output buffering
36:
37:
curl_setopt_array($ch$options);
38:
$returnContent curl_exec($ch);
39:
curl_close($ch);
40:
41:
var_dump($returnContent);
42: isset(
$tempname) and is_file($tempname) and @unlink($tempname);
43:
44:
?>
45:

Expected

== Starting test curl_setopt_array($ch, $options); ==
string(25) "Hello World!
Hello World!"

Output

== Starting test curl_setopt_array($ch, $options); ==
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

002+ string(215) "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
003+ <html><head>
002- string(25) "Hello World!
003- Hello World!"
004+ <title>404 Not Found</title>
005+ </head><body>
006+ <h1>Not Found</h1>
007+ <p>The requested URL /responder/get.php was not found on this server.</p>
008+ </body></html>
009+ "

 

Generated at Sun, 23 Jun 2019 06:34:16 +0000 (3 days ago)

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