Bug #81426 [NEW]: Regression in finfo_open

From: Date: Wed, 08 Sep 2021 21:24:32 +0000
Subject: Bug #81426 [NEW]: Regression in finfo_open
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236475@lists.php.net to get a copy of this message
From:             weierophinney
Operating system: Ubuntu 20.04
PHP version:      8.1.0RC1
Package:          Filesystem function related
Bug Type:         Bug
Bug description:Regression in finfo_open

Description:
------------
When supplying a MAGIC file to finfo_open, valid MAGIC files that were
parsed correctly in PHP 7.3 - 8.0 now result in parse errors within the
finfo extension.

An example of a MAGIC file that was working previously:
https://raw.githubusercontent.com/laminas/laminas-validator/2.15.x/test/File/_files/magic.7.mime

The above file has been used in unit tests since the 5.6 series without
issue; we only began seeing the issues when attempting to test against
PHP 8.1rc1.

Test script:
---------------
$finfo = finfo_open(FILEINFO_MIME_TYPE, 'magic.7.mime'); // file
referenced in Description section
echo finfo_file($finfo, 'plain.txt'); // assuming plain.txt is a text
file

Expected result:
----------------
text/plain; charset=us-ascii

Actual result:
--------------
PHP Warning:  finfo_open(): Unparsable number `a                \b
C.S0050-0 V1.0' in php shell code on line 1

Warning: finfo_open(): Unparsable number `a             \b C.S0050-0
V1.0' in php shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `b                \b
C.S0050-0-A V1.0.0' in php shell code on line 1

Warning: finfo_open(): Unparsable number `b             \b C.S0050-0-A
V1.0.0' in php shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `c                \b
C.S0050-0-B V1.0' in php shell code on line 1

Warning: finfo_open(): Unparsable number `c             \b C.S0050-0-B
V1.0' in php shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in
php shell code on line 1

Warning: finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in php
shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in
php shell code on line 1

Warning: finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in php
shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in
php shell code on line 1

Warning: finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in php
shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in
php shell code on line 1

Warning: finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in php
shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in
php shell code on line 1

Warning: finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in php
shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in
php shell code on line 1

Warning: finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in php
shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in
php shell code on line 1

Warning: finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in php
shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in
php shell code on line 1

Warning: finfo_open(): Unparsable number `\b, contains[@0x%x]: ' in php
shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `\b: ' in php shell code
on line 1

Warning: finfo_open(): Unparsable number `\b: ' in php shell code on
line 1
PHP Warning:  finfo_open(): Overflow for numeric type `leshort' value
0x223e9f78 in php shell code on line 1

Warning: finfo_open(): Overflow for numeric type `leshort' value
0x223e9f78 in php shell code on line 1
PHP Warning:  finfo_open(): `name       pgpkey' entries can only be
declared at top level in php shell code on line 1

Warning: finfo_open(): `name    pgpkey' entries can only be declared at
top level in php shell code on line 1
PHP Warning:  finfo_open(): Unparsable number `\b number=%d' in php
shell code on line 1

Warning: finfo_open(): Unparsable number `\b number=%d' in php shell
code on line 1
PHP Warning:  finfo_open(): Failed to load magic database at
"magic.7.mime" in php shell code on line 1

Warning: finfo_open(): Failed to load magic database at "magic.7.mime"
in php shell code on line 1


-- 
Edit bug report at https://bugs.php.net/bug.php?id=81426&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81426&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81426&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81426&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81426&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81426&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81426&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81426&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81426&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81426&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81426&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81426&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81426&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81426&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81426&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81426&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81426&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81426&r=mysqlcfg


Thread (3 messages)

« previous php.bugs (#236475) next »