1--TEST--
2finfo_open(): Testing magic_file names
3--EXTENSIONS--
4fileinfo
5--FILE--
6<?php
7
8try {
9    var_dump(finfo_open(FILEINFO_MIME, "\0"));
10} catch (ValueError $e) {
11    echo $e->getMessage(), "\n";
12}
13
14var_dump(finfo_open(FILEINFO_MIME, NULL));
15var_dump(finfo_open(FILEINFO_MIME, ''));
16var_dump(finfo_open(FILEINFO_MIME, 123));
17var_dump(finfo_open(FILEINFO_MIME, 1.0));
18var_dump(finfo_open(FILEINFO_MIME, '/foo/bar/inexistent'));
19
20?>
21--EXPECTF--
22finfo_open(): Argument #2 ($magic_database) must not contain any null bytes
23object(finfo)#%d (0) {
24}
25object(finfo)#%d (0) {
26}
27
28Warning: finfo_open(%s123): Failed to open stream: No such file or directory in %s on line %d
29
30Warning: finfo_open(%s123): Failed to open stream: No such file or directory in %s on line %d
31
32Warning: finfo_open(): Failed to load magic database at "%s123" in %s on line %d
33bool(false)
34
35Warning: finfo_open(%s1): Failed to open stream: No such file or directory in %s on line %d
36
37Warning: finfo_open(%s1): Failed to open stream: No such file or directory in %s on line %d
38
39Warning: finfo_open(): Failed to load magic database at "%s1" in %s on line %d
40bool(false)
41
42Warning: finfo_open(%sinexistent): Failed to open stream: No such file or directory in %s on line %d
43
44Warning: finfo_open(%sinexistent): Failed to open stream: No such file or directory in %s on line %d
45
46Warning: finfo_open(): Failed to load magic database at "%sinexistent" in %s on line %d
47bool(false)
48