Bug #81390 [Opn->Ver]: mb_detect_encoding() regression

From: Date: Fri, 27 Aug 2021 09:12:12 +0000
Subject: Bug #81390 [Opn->Ver]: mb_detect_encoding() regression
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236108@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81390&edit=1

 ID:                 81390
 Updated by:         cmb@php.net
 Reported by:        alec at alec dot pl
 Summary:            mb_detect_encoding() regression
-Status:             Open
+Status:             Verified
 Type:               Bug
 Package:            mbstring related
 PHP Version:        8.1.0beta3
 Block user comment: N
 Private report:     N

 New Comment:

Even mb_check_encoding() fails in the same way:
<https://3v4l.org/klWd0/rfc>.


Previous Comments:
------------------------------------------------------------------------
[2021-08-26 17:20:40] alec at alec dot pl

$test = 'test:test';

$encodings = array_diff(mb_list_encodings(), ['UUENCODE', 'wchar']);
echo mb_detect_encoding($test, $encodings, true);

returns HTML-ENTITIES, this makes no sense.

------------------------------------------------------------------------
[2021-08-26 17:10:34] alec at alec dot pl

Using $test = 'test:test' in the test script also will return UUENCODE. This is really
wrong.

------------------------------------------------------------------------
[2021-08-26 17:03:35] alec at alec dot pl

Description:
------------
The same code returns "ISO-8859-1" on PHP8.0 and "UUENCODE" on PHP8.1.0beta3.

Note: the text contains some ascii with two 0x0EB characters
Note: ISO-8859-1 is before UUENCODE in the mb_list_encodings() result.
Note: Even removing UUENCODE from the list does not make it to return expected ISO-8859-1

Test script:
---------------
$test = base64_decode('Q0hBUlNFVD13aW5kb3dzLTEyNTI6RG/rO0pvaG4=');

echo mb_detect_encoding($test, mb_list_encodings());

Expected result:
----------------
ISO-8859-1

Actual result:
--------------
UUENCODE


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81390&edit=1


Thread (37 messages)

« previous php.bugs (#236108) next »