mirror of
https://github.com/php/php-src.git
synced 2026-03-26 01:02:25 +01:00
Merge branch 'PHP-5.6'
* PHP-5.6: Fixed bug #67731 finfo::file() returns invalid mime type for binary files
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: funcs.c,v 1.67 2014/02/12 23:20:53 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: funcs.c,v 1.68 2014/02/18 11:09:31 kim Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@@ -173,8 +173,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
|
||||
const char *code_mime = "binary";
|
||||
const char *type = "application/octet-stream";
|
||||
const char *def = "data";
|
||||
|
||||
|
||||
const char *ftype = NULL;
|
||||
|
||||
if (nb == 0) {
|
||||
def = "empty";
|
||||
@@ -187,7 +186,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
|
||||
|
||||
if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
|
||||
looks_text = file_encoding(ms, ubuf, nb, &u8buf, &ulen,
|
||||
&code, &code_mime, &type);
|
||||
&code, &code_mime, &ftype);
|
||||
}
|
||||
|
||||
#ifdef __EMX__
|
||||
@@ -272,7 +271,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
|
||||
if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
|
||||
if (looks_text == 0)
|
||||
if ((m = file_ascmagic_with_encoding( ms, ubuf,
|
||||
nb, u8buf, ulen, code, type, looks_text))
|
||||
nb, u8buf, ulen, code, ftype, looks_text))
|
||||
!= 0) {
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr,
|
||||
|
||||
@@ -48,7 +48,7 @@ string(15) "MIFF image data"
|
||||
string(25) "RIFF (little-endian) data"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(26) "text/plain; charset=ebcdic"
|
||||
string(22) "binary; charset=binary"
|
||||
string(40) "application/octet-stream; charset=binary"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(25) "text/plain; charset=utf-8"
|
||||
|
||||
@@ -47,7 +47,7 @@ string(15) "MIFF image data"
|
||||
string(25) "RIFF (little-endian) data"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(26) "text/plain; charset=ebcdic"
|
||||
string(22) "binary; charset=binary"
|
||||
string(40) "application/octet-stream; charset=binary"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
string(25) "text/plain; charset=utf-8"
|
||||
|
||||
Reference in New Issue
Block a user