finfo_buffer_variation1-mb.phpt 1.3 KB

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