mirror of
https://github.com/php/php-src.git
synced 2024-10-16 22:12:33 +00:00
ac3ae236ec
- 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)
27 lines
584 B
PHP
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)
|