1--TEST--
2curl_setopt() call with CURLOPT_HTTPHEADER
3--CREDITS--
4Paul Sohier
5#phptestfest utrecht
6--SKIPIF--
7<?php include 'skipif.inc'; ?>
8--FILE--
9<?php
10
11include 'server.inc';
12$host = curl_cli_server_start();
13
14// start testing
15echo "*** curl_setopt() call with CURLOPT_HTTPHEADER\n";
16
17$url = "{$host}/";
18$ch = curl_init();
19
20try {
21    curl_setopt($ch, CURLOPT_HTTPHEADER, 1);
22} catch (TypeError $exception) {
23    echo $exception->getMessage() . "\n";
24}
25
26$curl_content = curl_exec($ch);
27curl_close($ch);
28
29var_dump( $curl_content );
30
31$ch = curl_init();
32
33ob_start(); // start output buffering
34curl_setopt($ch, CURLOPT_HTTPHEADER, array());
35curl_setopt($ch, CURLOPT_URL, $host);
36
37$curl_content = curl_exec($ch);
38ob_end_clean();
39curl_close($ch);
40
41var_dump( $curl_content );
42?>
43--EXPECT--
44*** curl_setopt() call with CURLOPT_HTTPHEADER
45curl_setopt(): The CURLOPT_HTTPHEADER option must have an array value
46bool(false)
47bool(true)
48