You have been subscribed to a public bug:

PHP internally uses libmagic for getting information about files. This
sample php code consumes 483 MB of RAM for detecting mimetype of a 48 MB
MP3 file using php7.4 but it uses only 56 MB with php7.2.

    $finfo = new finfo(FILEINFO_MIME_TYPE, '');
    $contents = file_get_contents('file.mp3');
    echo($finfo->buffer($contents));

The bug is reported to php as well. They say it should be reported to
libmagic. See https://bugs.php.net/bug.php?id=79263

The PHP bug is over 1 year old.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: libmagic1 1:5.32-2ubuntu0.4
ProcVersionSignature: Ubuntu 4.15.0-135.139-generic 4.15.18
Uname: Linux 4.15.0-135-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7.21
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Wed Feb  3 15:04:30 2021
Dependencies:
 gcc-8-base 8.4.0-1ubuntu1~18.04
 libc6 2.27-3ubuntu1.4
 libgcc1 1:8.4.0-1ubuntu1~18.04
 libmagic-mgc 1:5.32-2ubuntu0.4
 zlib1g 1:1.2.11.dfsg-0ubuntu2
InstallationDate: Installed on 2018-10-07 (849 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
ProcEnviron:
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: file
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: file (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug bionic
-- 
Memory problems running finfo::buffer with PHP_CLI
https://bugs.launchpad.net/bugs/1914401
You received this bug notification because you are a member of Ubuntu Touch 
seeded packages, which is subscribed to file in Ubuntu.

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to