1--TEST--
2Test get_headers() function: wrong type for argument format
3--CREDITS--
4June Henriksen <juneih@redpill-linpro.com>
5#PHPTestFest2009 Norway 2009-06-09 \o/
6--FILE--
7<?php
8/* Prototype  : proto array get_headers(string url[, int format])
9 * Description: Fetches all the headers sent by the server in response to a HTTP request
10 * Source code: ext/standard/url.c
11 * Alias to functions:
12 */
13
14echo "*** Testing get_headers() : error conditions ***\n";
15$url = 'http://php.net';
16
17// Format argument as type String
18echo "\n-- Testing get_headers() function with format argument as type string --\n";
19var_dump( get_headers($url, "#PHPTestFest2009 Norway") );
20
21// Format argument as type Array
22echo "\n-- Testing get_headers() function with format argument as type array --\n";
23var_dump( get_headers($url, array()) );
24
25// Format argument as type Object
26class testObject
27{
28}
29
30$object = new testObject();
31echo "\n-- Testing get_headers() function with format argument as type object --\n";
32var_dump( get_headers($url, $object) );
33
34
35echo "Done"
36?>
37--EXPECTF--
38*** Testing get_headers() : error conditions ***
39
40-- Testing get_headers() function with format argument as type string --
41
42Warning: get_headers() expects parameter 2 to be long, string given in %s on line 13
43NULL
44
45-- Testing get_headers() function with format argument as type array --
46
47Warning: get_headers() expects parameter 2 to be long, array given in %s on line 17
48NULL
49
50-- Testing get_headers() function with format argument as type object --
51
52Warning: get_headers() expects parameter 2 to be long, object given in %s on line 26
53NULL
54Done
55
56