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/bug48207.phpt ('Test curl_setopt() CURLOPT_FILE readonly file handle')

Script

1: <?php
2:
/*
3:  * Description       : Adds a file which stores the received data from curl_exec();
4:  * Source code       : ext/curl/multi.c
5:  * Test documentation: http://wiki.php.net/qa/temp/ext/curl
6:  */
7:
8: // Figure out what handler to use
9:
include 'server.inc';
10:
$host curl_cli_server_start();
11: if(!empty(
$host)) {
12:
13:     
// Use the set Environment variable
14:     
$url "$host/get.php?test=1";
15:
16: } else {
17:
18:     
// Create a temporary file for the test
19:     
$tempname tempnam(sys_get_temp_dir(), 'CURL_HANDLE');
20:     
$url 'file://'$tempname;
21:
22:     
// add the test data to the file
23:     
file_put_contents($tempname"Hello World!\nHello World!");
24: }
25:
26:
27:
$tempfile    tempnam(sys_get_temp_dir(), 'CURL_FILE_HANDLE');
28:
29:
$ch curl_init($url);
30:
$fp fopen($tempfile"r"); // Opening 'fubar' with the incorrect readonly flag
31:
curl_setopt($chCURLOPT_FILE$fp);
32:
curl_exec($ch);
33:
curl_close($ch);
34:
is_file($tempfile) and @unlink($tempfile);
35: isset(
$tempname) and is_file($tempname) and @unlink($tempname);
36:
?>
37:

Expected

Warning: curl_setopt(): the provided file handle is not writable in %s on line %d
Hello World!
Hello World!

Output

Warning: curl_setopt(): the provided file handle is not writable in /var/php_gcov/PHP_7_1/ext/curl/tests/bug48207.php on line 31
<!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+ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
003+ <html><head>
002- 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>

 

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

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