1--TEST--
2Test finfo_open() function : error functionality
3--SKIPIF--
4<?php require_once(dirname(__FILE__) . '/skipif.inc');
5--FILE--
6<?php
7/* Prototype  : resource finfo_open([int options [, string arg]])
8 * Description: Create a new fileinfo resource.
9 * Source code: ext/fileinfo/fileinfo.c
10 * Alias to functions:
11 */
12
13$magicFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic';
14
15echo "*** Testing finfo_open() : error functionality ***\n";
16
17var_dump( finfo_open( FILEINFO_MIME, 'foobarfile' ) );
18var_dump( finfo_open( array(), $magicFile ) );
19var_dump( finfo_open( FILEINFO_MIME, $magicFile, 'extraArg' ) );
20var_dump( finfo_open( PHP_INT_MAX - 1, $magicFile ) );
21var_dump( finfo_open( 'foobar' ) );
22
23var_dump( new finfo('foobar') );
24
25?>
26===DONE===
27--EXPECTF--
28*** Testing finfo_open() : error functionality ***
29
30Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12
31
32Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12
33
34Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line 12
35bool(false)
36
37Warning: finfo_open() expects parameter 1 to be long, array given in %sfinfo_open_error.php on line 13
38bool(false)
39
40Warning: finfo_open() expects at most 2 parameters, 3 given in %sfinfo_open_error.php on line 14
41bool(false)
42
43Notice: finfo_open(): Warning: using regular magic file `%smagic' in %sfinfo_open_error.php on line 15
44resource(6) of type (file_info)
45
46Warning: finfo_open() expects parameter 1 to be long, string given in %sfinfo_open_error.php on line 16
47bool(false)
48
49Warning: finfo::finfo() expects parameter 1 to be long, string given in %sfinfo_open_error.php on line 18
50NULL
51===DONE===
52