1--TEST-- 2Test finfo_buffer() function : basic functionality 3--SKIPIF-- 4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> 5--FILE-- 6<?php 7/* Prototype : string finfo_buffer(resource finfo, char *string [, int options [, resource context]]) 8 * Description: Return infromation about a string buffer. 9 * Source code: ext/fileinfo/fileinfo.c 10 * Alias to functions: 11 */ 12 13$magicFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic私はガラスを食べられます'; 14 15$options = array( 16 FILEINFO_NONE, 17 FILEINFO_MIME, 18); 19 20$buffers = array( 21 "Regular string here", 22 "\177ELF", 23 "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003", 24 "\x55\x7A\x6E\x61", 25 "id=ImageMagick", 26 "RIFFüîò^BAVI LISTv", 27); 28 29echo "*** Testing finfo_buffer() : variation functionality with oo interface ***\n"; 30 31foreach( $options as $option ) { 32 $finfo = new finfo( $option, $magicFile ); 33 foreach( $buffers as $string ) { 34 var_dump( $finfo->buffer( $string, $option ) ); 35 } 36} 37 38?> 39===DONE=== 40--EXPECTF-- 41*** Testing finfo_buffer() : variation functionality with oo interface *** 42string(36) "ASCII text, with no line terminators" 43string(3) "ELF" 44string(22) "old ACE/gr binary file" 45string(12) "xo65 object," 46string(15) "MIFF image data" 47string(25) "RIFF (little-endian) data" 48string(28) "text/plain; charset=us-ascii" 49string(26) "text/plain; charset=ebcdic" 50string(40) "application/octet-stream; charset=binary" 51string(28) "text/plain; charset=us-ascii" 52string(28) "text/plain; charset=us-ascii" 53string(25) "text/plain; charset=utf-8" 54===DONE=== 55