php-src/ext/fileinfo/tests/finfo_file_001.phpt
Felipe Pena ac3ae236ec - MFB:
- use php's stream in libmagic
  - remove duplicate code (like mime_content_type() compatibility function
    now use the same base as finfo_file())
  - make it portable (works now on windows too, belongs other OSes)

  - don't close caller streams in libmagic (prevent leak and zombie stream)
  - string returned by magic_* are freed on magic_close, duplicate before
    calling magic_close (set return value)
  - if stat failed, don't try to call magic_* (when FILEINFO_MODE_FILE)
2008-09-07 20:29:54 +00:00

27 lines
584 B
PHP

--TEST--
finfo_file(): Testing file names
--FILE--
<?php
$fp = finfo_open();
var_dump(finfo_file($fp, "\0"));
var_dump(finfo_file($fp, ''));
var_dump(finfo_file($fp, NULL));
var_dump(finfo_file($fp, '.'));
var_dump(finfo_file($fp, '&'));
?>
--EXPECTF--
Warning: finfo_file(): Empty filename or path in %s on line %d
bool(false)
Warning: finfo_file(): Empty filename or path in %s on line %d
bool(false)
Warning: finfo_file(): Empty filename or path in %s on line %d
bool(false)
string(9) "directory"
Warning: finfo_file(): File or path not found '&' in %s on line %d
bool(false)