1--TEST--
2Test finfo_buffer() function : error conditions
3--SKIPIF--
4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
5--FILE--
6<?php
7/* Prototype  : string finfo_buffer(resource finfo, char *string [, int options [, resource context]])
8 * Description: Return infromation about a string buffer.
9 * Source code: ext/fileinfo/fileinfo.c
10 * Alias to functions:
11 */
12
13$magicFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic';
14
15echo "*** Testing finfo_buffer() : error conditions ***\n";
16
17$finfo = finfo_open( FILEINFO_NONE, $magicFile );
18
19//Test finfo_buffer with one more than the expected number of arguments
20echo "\n-- Testing finfo_buffer() function with more than expected no. of arguments --\n";
21
22$context = stream_context_get_default();
23$extra_arg = 10;
24var_dump( finfo_buffer($finfo, "foobar", FILEINFO_MIME, $context, $extra_arg) );
25
26// Testing finfo_buffer with one less than the expected number of arguments
27echo "\n-- Testing finfo_buffer() function with less than expected no. of arguments --\n";
28
29var_dump( finfo_buffer($finfo) );
30
31?>
32===DONE===
33--EXPECTF--
34*** Testing finfo_buffer() : error conditions ***
35
36-- Testing finfo_buffer() function with more than expected no. of arguments --
37
38Warning: finfo_buffer() expects at most 4 parameters, 5 given in %s on line %d
39bool(false)
40
41-- Testing finfo_buffer() function with less than expected no. of arguments --
42
43Warning: finfo_buffer() expects at least 2 parameters, 1 given in %s on line %d
44bool(false)
45===DONE===
46