Bug #79263 [Com]: finfo_buffer fails with "PHP Fatal error: Allowed memory size of"
| From: | bugreports at gmail dot com | Date: | Wed, 12 Feb 2020 23:55:51 +0000 |
| Subject: | Bug #79263 [Com]: 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-225544@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
Comment by: bugreports at gmail dot com
Reported by: anestis at fraganestis dot eu
Summary: finfo_buffer fails with "PHP Fatal error: Allowed
memory size of"
Status: Open
Type: Bug
Package: Unknown/Other Function
Operating System: Debian 9
PHP Version: 7.4.2
Block user comment: N
Private report: N
New Comment:
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);
Previous Comments:
------------------------------------------------------------------------
[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