xref: /php-src/ext/curl/tests/bug80595.phpt (revision 8567bc10)
1--TEST--
2Bug #80595 (Resetting POSTFIELDS to empty array breaks request)
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7include 'server.inc';
8$host = curl_cli_server_start();
9$ch = curl_init();
10curl_setopt_array($ch, [
11    CURLOPT_RETURNTRANSFER => true,
12    CURLOPT_POST           => true,
13    CURLOPT_URL            => "{$host}/get.inc?test=post",
14]);
15
16curl_setopt($ch, CURLOPT_POSTFIELDS, ['foo' => 'bar']);
17var_dump(curl_exec($ch));
18
19curl_setopt($ch, CURLOPT_POSTFIELDS, []);
20var_dump(curl_exec($ch));
21?>
22--EXPECT--
23string(43) "array(1) {
24  ["foo"]=>
25  string(3) "bar"
26}
27"
28string(13) "array(0) {
29}
30"
31