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_basic_006.phpt ('Test curl_opt() function with CURLOPT_WRITEFUNCTION parameter set to a closure')

Script

1: <?php
2:
/* Prototype  : bool curl_setopt(resource ch, int option, mixed value)
3:  * Description: Set an option for a cURL transfer
4:  * Source code: ext/curl/interface.c
5:  * Alias to functions:
6:  */
7:
8:   
include 'server.inc';
9:   
$host curl_cli_server_start();
10:
11:   
// start testing
12:   
echo '*** Testing curl_setopt($ch, CURLOPT_WRITEFUNCTION, <closure>); ***' "\n";
13:
14:   
$url "{$host}/get.php?test=get";
15:   
$ch curl_init();
16:   
$alldata '';
17:   
ob_start(); // start output buffering
18:   
curl_setopt($chCURLOPT_URL$url); //set the url we want to use
19:   
curl_setopt($chCURLOPT_WRITEFUNCTION, function ($ch$data) {
20:     
$GLOBALS['alldata'] .= $data;
21:     return 
strlen ($data);
22:   });
23:
24:   
curl_exec($ch);
25:   
curl_close($ch);
26:   
ob_end_flush();
27:   echo 
"Data: $alldata";
28:
?>
29:
===DONE===
30:

Expected

*** Testing curl_setopt($ch, CURLOPT_WRITEFUNCTION, <closure>); ***
Data: Hello World!
Hello World!===DONE===

Output

*** Testing curl_setopt($ch, CURLOPT_WRITEFUNCTION, <closure>); ***
Data: <!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>
===DONE===

Diff

002+ Data: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
003+ <html><head>
002- Data: Hello World!
003- Hello World!===DONE===
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+ ===DONE===

 

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

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