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
23try {
24    var_dump( new finfo('foobar') );
25} catch (TypeError $e) {
26    echo $e->getMessage(), "\n";
27}
28
29?>
30===DONE===
31--EXPECTF--
32*** Testing finfo_open() : error functionality ***
33
34Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12
35
36Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12
37
38Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line 12
39bool(false)
40
41Warning: finfo_open() expects parameter 1 to be integer, array given in %sfinfo_open_error.php on line 13
42bool(false)
43
44Warning: finfo_open() expects at most 2 parameters, 3 given in %sfinfo_open_error.php on line 14
45bool(false)
46
47Notice: finfo_open(): Warning: using regular magic file `%smagic' in %sfinfo_open_error.php on line 15
48resource(6) of type (file_info)
49
50Warning: finfo_open() expects parameter 1 to be integer, string given in %sfinfo_open_error.php on line 16
51bool(false)
52finfo::finfo() expects parameter 1 to be integer, string given
53===DONE===
54