php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76704 mb_detect_order return value varies based on argument type
Submitted: 2018-08-04 00:13 UTC Modified: 2018-08-04 12:24 UTC
From: smokey101stair at gmail dot com Assigned: cmb (profile)
Status: Closed Package: mbstring related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2018-08-04 00:13 UTC] smokey101stair at gmail dot com
Description:
------------
The function mb_detect_order() can receive either a comma separated list of encodings or an array of encodings. However, its return value varies based on whether it is given a string or an array that contain the same values.

Test script:
---------------
https://3v4l.org/gJfAO

Expected result:
----------------
mb_detect_order() should return the same value regardless of which type is used for the encoding_list parameter. HHVM seems to not be affected by this.

Actual result:
--------------
When given a string, mb_detect_order() will return true if it finds at least one supported encoding in the list.

When given an array, mb_detect_order() will return false if it finds any non-supported encoding.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-04 02:07 UTC] yohgaki@php.net
-Status: Open +Status: Analyzed -Operating System: Windows 10 +Operating System: Irrelevant
 [2018-08-04 02:07 UTC] yohgaki@php.net
mb_detect_order() logic is broken and needed to be fixed.
It doesn't work as it should with multiple encodings since it is implemented.
 [2018-08-04 12:24 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c00f5e6531a3f72bb8f7c107d2c390fadad736a0
Log: Fix #76704: mb_detect_order return value varies based on argument type
 [2018-08-04 12:24 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
 [2018-08-04 12:24 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 09:01:30 2024 UTC