1--TEST--
2Test finfo_buffer() function : basic functionality
3--SKIPIF--
4<?php require_once(__DIR__ . '/skipif.inc'); ?>
5--FILE--
6<?php
7$magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magic私はガラスを食べられます';
8
9$options = array(
10    FILEINFO_NONE,
11    FILEINFO_MIME,
12);
13
14$buffers = array(
15    "Regular string here",
16    "\177ELF",
17    "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003",
18    "\x55\x7A\x6E\x61",
19    "id=ImageMagick\x0a\x0c\x0a:\x1a",
20    "RIFFüîò^BAVI LISTv",
21);
22
23echo "*** Testing finfo_buffer() : basic functionality ***\n";
24
25foreach( $options as $option ) {
26    $finfo = finfo_open( $option, $magicFile );
27    foreach( $buffers as $string ) {
28        var_dump( finfo_buffer( $finfo, $string, $option ) );
29    }
30    finfo_close( $finfo );
31}
32
33?>
34--EXPECT--
35*** Testing finfo_buffer() : basic functionality ***
36string(36) "ASCII text, with no line terminators"
37string(3) "ELF"
38string(22) "old ACE/gr binary file"
39string(12) "xo65 object,"
40string(15) "MIFF image data"
41string(25) "RIFF (little-endian) data"
42string(28) "text/plain; charset=us-ascii"
43string(26) "text/plain; charset=ebcdic"
44string(40) "application/octet-stream; charset=binary"
45string(28) "text/plain; charset=us-ascii"
46string(28) "image/x-miff; charset=binary"
47string(25) "text/plain; charset=utf-8"
48