xref: /PHP-7.0/ext/curl/tests/bug48203-win32.phpt (revision 2252d4e5)
1--TEST--
2Bug #48203 (Crash when CURLOPT_STDERR is set to regular file)
3--SKIPIF--
4<?php include 'skipif.inc'; ?>
5<?php
6if(substr(PHP_OS, 0, 3) != 'WIN' ) {
7    die('skip Windows only test');
8}
9?>
10--FILE--
11<?php
12include 'server.inc';
13$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
14
15$ch = curl_init();
16
17curl_setopt($ch, CURLOPT_VERBOSE, 1);
18curl_setopt($ch, CURLOPT_STDERR, $fp);
19curl_setopt($ch, CURLOPT_URL, curl_cli_server_start());
20
21fclose($fp); // <-- premature close of $fp caused a crash!
22
23curl_exec($ch);
24curl_close($ch);
25
26echo "Ok\n";
27
28?>
29--CLEAN--
30<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
31--EXPECTF--
32Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
33Hello World!
34Hello World!Ok
35%A
36
37