Edit report at https://bugs.php.net/bug.php?id=79213&edit=1
ID: 79213
User updated by: info at ioweb dot gr
Reported by: info at ioweb dot gr
Summary: mb_check_encoding doesn't work with base64
Status: Open
Type: Bug
Package: Unknown/Other Function
Operating System: Debian 9, Ubuntu 18.04
PHP Version: 7.2.27
Block user comment: N
Private report: N
New Comment:
From reading the documentation I reached this assumption
In the docs it says for mb_check_encoding
Checks if the specified byte stream is valid for the specified encoding.
A list of supported encodings I can get from
mb_list_encodings which will also include base64
So I would assume mb_check_encoding would be able to handle all encodings that mb_list_encodings
shows
Previous Comments:
------------------------------------------------------------------------
[2020-02-02 22:05:04] bugreports at gmail dot com
why do you expect base64 strings to be detected as whatever multibyte encoding?
it's a plain string - not more and not less and "BASE64" is not a multibyte encoding
at all
------------------------------------------------------------------------
[2020-02-02 21:54:05] info at ioweb dot gr
Description:
------------
mb_check_encoding is unable to detect strings that are encoded with base64, it will show false
Example string "test" will yield "dGVzdA=="
but mb_check_encoding fails to detect correctly this is a base64 encoded string
Test script:
---------------
$base64encoded = base64_encode("test");
$valid = mb_check_encoding($base64encoded, "BASE64");
Expected result:
----------------
$valid is true
Actual result:
--------------
$valid is false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79213&edit=1