xref: /php-src/ext/curl/tests/bug48203.phpt (revision 8567bc10)
1--TEST--
2Bug #48203 (Crash when CURLOPT_STDERR is set to regular file)
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7include 'server.inc';
8$fp = fopen(__DIR__ . '/bug48203.tmp', 'w');
9
10$ch = curl_init();
11
12curl_setopt($ch, CURLOPT_VERBOSE, 1);
13curl_setopt($ch, CURLOPT_STDERR, $fp);
14curl_setopt($ch, CURLOPT_URL, curl_cli_server_start());
15
16fclose($fp); // <-- premature close of $fp caused a crash!
17
18curl_exec($ch);
19curl_close($ch);
20
21echo "Ok\n";
22
23?>
24--CLEAN--
25<?php @unlink(__DIR__ . '/bug48203.tmp'); ?>
26--EXPECTF--
27Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
28%A
29Hello World!
30Hello World!%A
31Ok
32