mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
fileinfo: Re-add Apple flag
It is not supported for all kinds of data, but it is definitely usable. Signed-off-by: Anatol Belski <ab@php.net>
This commit is contained in:
@@ -129,10 +129,7 @@ PHP_MINIT_FUNCTION(finfo)
|
||||
#ifdef MAGIC_RAW
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT);
|
||||
#endif
|
||||
#if 0
|
||||
/* seems not usable yet. */
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_APPLE", MAGIC_APPLE, CONST_CS|CONST_PERSISTENT);
|
||||
#endif
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_EXTENSION", MAGIC_EXTENSION, CONST_CS|CONST_PERSISTENT);
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
17
ext/fileinfo/tests/finfo_apple_flag.phpt
Normal file
17
ext/fileinfo/tests/finfo_apple_flag.phpt
Normal file
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Test FILEINFO_APPLE flag
|
||||
--EXTENSIONS--
|
||||
fileinfo
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$f = new finfo;
|
||||
var_dump($f->file(__DIR__ . "/resources/test.jpg", FILEINFO_APPLE));
|
||||
var_dump($f->file(__DIR__ . "/resources/test.gif", FILEINFO_APPLE));
|
||||
var_dump($f->file(__DIR__ . "/resources/test.ppt", FILEINFO_APPLE));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(8) "8BIMJPEG"
|
||||
string(8) "8BIMGIFf"
|
||||
string(8) "????PPT3"
|
||||
Reference in New Issue
Block a user