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() : basic functionality ***\n"; 30 31foreach( $options as $option ) { 32 $finfo = finfo_open( $option, $magicFile ); 33 foreach( $buffers as $string ) { 34 var_dump( finfo_buffer( $finfo, $string, $option ) ); 35 } 36 finfo_close( $finfo ); 37} 38 39?> 40===DONE=== 41--EXPECT-- 42*** Testing finfo_buffer() : basic functionality *** 43string(36) "ASCII text, with no line terminators" 44string(3) "ELF" 45string(22) "old ACE/gr binary file" 46string(12) "xo65 object," 47string(15) "MIFF image data" 48string(25) "RIFF (little-endian) data" 49string(28) "text/plain; charset=us-ascii" 50string(26) "text/plain; charset=ebcdic" 51string(40) "application/octet-stream; charset=binary" 52string(28) "text/plain; charset=us-ascii" 53string(28) "text/plain; charset=us-ascii" 54string(25) "text/plain; charset=utf-8" 55===DONE=== 56