1--TEST--
2Test stream_get_meta_data() function : error conditions
3--FILE--
4<?php
5/* Prototype  : proto array stream_get_meta_data(resource fp)
6 * Description: Retrieves header/meta data from streams/file pointers
7 * Source code: ext/standard/streamsfuncs.c
8 * Alias to functions: socket_get_status
9 */
10
11echo "*** Testing stream_get_meta_data() : error conditions ***\n";
12
13// Zero arguments
14echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n";
15var_dump( stream_get_meta_data() );
16
17//Test stream_get_meta_data with one more than the expected number of arguments
18echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n";
19
20$fp = null;
21$extra_arg = 10;
22var_dump( stream_get_meta_data($fp, $extra_arg) );
23
24echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n";
25$fp = null;
26var_dump(stream_get_meta_data($fp));
27
28echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n";
29$fp = fopen(__FILE__, 'r');
30fclose($fp);
31var_dump(stream_get_meta_data($fp));
32
33echo "Done";
34?>
35--EXPECTF--
36*** Testing stream_get_meta_data() : error conditions ***
37
38-- Testing stream_get_meta_data() function with Zero arguments --
39
40Warning: stream_get_meta_data() expects exactly 1 parameter, 0 given in %s on line %i
41NULL
42
43-- Testing stream_get_meta_data() function with more than expected no. of arguments --
44
45Warning: stream_get_meta_data() expects exactly 1 parameter, 2 given in %s on line %i
46NULL
47
48-- Testing stream_get_meta_data() function with invalid stream resource --
49
50Warning: stream_get_meta_data() expects parameter 1 to be resource, null given in %s on line %i
51NULL
52
53-- Testing stream_get_meta_data() function with closed stream resource --
54
55Warning: stream_get_meta_data(): supplied resource is not a valid stream resource in %s on line %i
56bool(false)
57Done
58