Bug #79263 [Opn->Fbk]: finfo_buffer fails with "PHP Fatal error: Allowed memory size of"
| From: | requinix@php.net | Date: | Thu, 13 Feb 2020 00:46:17 +0000 |
| Subject: | Bug #79263 [Opn->Fbk]: finfo_buffer fails with "PHP Fatal error: Allowed memory size of" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225547@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79263&edit=1
ID: 79263
Updated by: requinix@php.net
Reported by: anestis at fraganestis dot eu
Summary: finfo_buffer fails with "PHP Fatal error: Allowed
memory size of"
-Status: Open
+Status: Feedback
Type: Bug
Package: Unknown/Other Function
Operating System: Debian 9
PHP Version: 7.4.2
Block user comment: N
Private report: N
New Comment:
@anestis: How large is $buffer, and are its contents valid (not corrupted) for the file type?
Previous Comments:
------------------------------------------------------------------------
[2020-02-12 23:55:51] bugreports at gmail dot com
or don't pass around whole files in strings which allocates memory often two or even three
times
$h = finfo_open();
$mime_type = finfo_file($h, $path, FILEINFO_MIME_TYPE);
finfo_close($h);
------------------------------------------------------------------------
[2020-02-12 23:45:58] KseniMailwow at gmail dot com
Use memory_limit (in ini) to increase the memory limit. This is not a bug.
------------------------------------------------------------------------
[2020-02-12 07:08:04] anestis at fraganestis dot eu
Description:
------------
finfo_buffer for the contents of a specific file (which I can provide but not make it completely
public) fails with
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 138546568
bytes)
Test script:
---------------
function getBufferMime($buffer)
{
$h = finfo_open(FILEINFO_MIME);
$mime = finfo_buffer($h, $buffer);
finfo_close($h);
return $mime;
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79263&edit=1