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

Test Failure Report for ext/curl/tests/bug54798.phpt ('Bug #54798 (Segfault when CURLOPT_STDERR file pointer is closed before calling curl_exec)')

Script

1: <?php
2:
3:
function checkForClosedFilePointer($host$curl_option$description) {
4:     
$fp fopen(dirname(__FILE__) . '/bug54798.tmp''w+');
5:
6:     
$ch curl_init();
7:
8:     
// we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly
9:     
if (CURLOPT_STDERR == $curl_option) {
10:         
curl_setopt($chCURLOPT_VERBOSE1);
11:     }
12:
13:     if (
CURLOPT_INFILE == $curl_option) {
14:         
curl_setopt($chCURLOPT_UPLOAD1);
15:     }
16:
17:     
curl_setopt($ch$curl_option$fp);
18:
19:     
curl_setopt($chCURLOPT_URL$host);
20:     
curl_setopt($chCURLOPT_RETURNTRANSFER1);
21:
22:     
fclose($fp); // <-- premature close of $fp caused a crash!
23:
24:     
curl_exec($ch);
25:
26:     
curl_close($ch);
27:
28:     echo 
"Ok for $description\n";
29: }
30:
31:
$options_to_check = array(
32:     
"CURLOPT_STDERR",
33:     
"CURLOPT_WRITEHEADER",
34:     
"CURLOPT_FILE",
35:     
"CURLOPT_INFILE"
36:
);
37:
38: include 
'server.inc';
39:
$host curl_cli_server_start();
40: foreach(
$options_to_check as $option) {
41:     
checkForClosedFilePointer($hostconstant($option), $option);
42: }
43:
44:
?>
45:
===DONE===
46:

Expected

%AOk for CURLOPT_STDERR

%AOk for CURLOPT_WRITEHEADER

%AHello World!
Hello World!Ok for CURLOPT_FILE

%AOk for CURLOPT_INFILE
===DONE===

Output

Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in /var/php_gcov/PHP_HEAD/ext/curl/tests/bug54798.php on line 24
* About to connect() to gcov.php.net port 80 (#0)
*   Trying 208.69.122.227... * connected
* Connected to gcov.php.net (208.69.122.227) port 80 (#0)
> GET /responder HTTP/1.1
Host: gcov.php.net
Accept: */*

< HTTP/1.1 301 Moved Permanently
< Date: Sat, 12 Jan 2019 04:52:19 GMT
< Server: Apache/2.2.15 (CentOS)
< Location: http://gcov.php.net/responder/
< Content-Length: 238
< Connection: close
< Content-Type: text/html; charset=iso-8859-1
< 
* Closing connection #0
Ok for CURLOPT_STDERR

Warning: curl_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in /var/php_gcov/PHP_HEAD/ext/curl/tests/bug54798.php on line 24
Ok for CURLOPT_WRITEHEADER

Warning: curl_exec(): CURLOPT_FILE resource has gone away, resetting to default in /var/php_gcov/PHP_HEAD/ext/curl/tests/bug54798.php on line 24
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://gcov.php.net/responder/">here</a>.</p>
</body></html>
Ok for CURLOPT_FILE

Warning: curl_exec(): CURLOPT_INFILE resource has gone away, resetting to default in /var/php_gcov/PHP_HEAD/ext/curl/tests/bug54798.php on line 24
Ok for CURLOPT_INFILE
===DONE===

Diff

001+ Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in /var/php_gcov/PHP_HEAD/ext/curl/tests/bug54798.php on line 24
002+ * About to connect() to gcov.php.net port 80 (#0)
003+ *   Trying 208.69.122.227... * connected
004+ * Connected to gcov.php.net (208.69.122.227) port 80 (#0)
005+ > GET /responder HTTP/1.1
006+ Host: gcov.php.net
007+ Accept: */*
008+ 
009+ < HTTP/1.1 301 Moved Permanently
010+ < Date: Sat, 12 Jan 2019 04:52:19 GMT
011+ < Server: Apache/2.2.15 (CentOS)
012+ < Location: http://gcov.php.net/responder/
013+ < Content-Length: 238
014+ < Connection: close
015+ < Content-Type: text/html; charset=iso-8859-1
016+ < 
017+ * Closing connection #0
005- %AHello World!
006- Hello World!Ok for CURLOPT_FILE
020+ Warning: curl_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in /var/php_gcov/PHP_HEAD/ext/curl/tests/bug54798.php on line 24
023+ Warning: curl_exec(): CURLOPT_FILE resource has gone away, resetting to default in /var/php_gcov/PHP_HEAD/ext/curl/tests/bug54798.php on line 24
024+ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
025+ <html><head>
026+ <title>301 Moved Permanently</title>
027+ </head><body>
028+ <h1>Moved Permanently</h1>
029+ <p>The document has moved <a href="http://gcov.php.net/responder/">here</a>.</p>
030+ </body></html>
031+ Ok for CURLOPT_FILE
033+ Warning: curl_exec(): CURLOPT_INFILE resource has gone away, resetting to default in /var/php_gcov/PHP_HEAD/ext/curl/tests/bug54798.php on line 24

 

Generated at Mon, 14 Jan 2019 03:56:25 +0000 (4 days ago)

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