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() : variation functionality with oo interface ***\n";
24
25foreach( $options as $option ) {
26    $finfo = new finfo( $option, $magicFile );
27    foreach( $buffers as $string ) {
28        var_dump( $finfo->buffer( $string, $option ) );
29    }
30}
31
32?>
33--EXPECT--
34*** Testing finfo_buffer() : variation functionality with oo interface ***
35string(36) "ASCII text, with no line terminators"
36string(3) "ELF"
37string(22) "old ACE/gr binary file"
38string(12) "xo65 object,"
39string(15) "MIFF image data"
40string(25) "RIFF (little-endian) data"
41string(28) "text/plain; charset=us-ascii"
42string(26) "text/plain; charset=ebcdic"
43string(40) "application/octet-stream; charset=binary"
44string(28) "text/plain; charset=us-ascii"
45string(28) "image/x-miff; charset=binary"
46string(25) "text/plain; charset=utf-8"
47