1--TEST--
2Test finfo_file() function : basic functionality
3--EXTENSIONS--
4fileinfo
5--FILE--
6<?php
7$magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magic';
8$finfo = finfo_open( FILEINFO_MIME );
9
10echo "*** Testing finfo_file() : basic functionality ***\n";
11
12// Calling finfo_file() with all possible arguments
13var_dump( finfo_file( $finfo, __FILE__) );
14var_dump( finfo_file( $finfo, __FILE__, FILEINFO_CONTINUE ) );
15var_dump( finfo_file( $finfo, $magicFile ) );
16try {
17    var_dump( finfo_file( $finfo, $magicFile.chr(0).$magicFile) );
18} catch (\TypeError $e) {
19    echo $e->getMessage() . \PHP_EOL;
20}
21
22?>
23--EXPECT--
24*** Testing finfo_file() : basic functionality ***
25string(28) "text/x-php; charset=us-ascii"
26string(22) "PHP script, ASCII text"
27string(28) "text/plain; charset=us-ascii"
28finfo_file(): Argument #2 ($filename) must not contain any null bytes
29