Bug #79154 [Asn->Csd]: mb_convert_encoding() can modify $from_encoding
| From: | cmb@php.net | Date: | Wed, 22 Jan 2020 09:33:00 +0000 |
| Subject: | Bug #79154 [Asn->Csd]: mb_convert_encoding() can modify $from_encoding | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225043@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79154&edit=1
ID: 79154
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: mb_convert_encoding() can modify $from_encoding
-Status: Assigned
+Status: Closed
Type: Bug
Package: mbstring related
Operating System: *
PHP Version: 7.3Git-2020-01-22 (Git)
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9be31a582a83c38cdace9d54778398bc9fe0c7a9
Log: Fix #79154: mb_convert_encoding() can modify $from_encoding
Previous Comments:
------------------------------------------------------------------------
[2020-01-22 09:17:23] cmb@php.net
Description:
------------
If an array containing values which are not strings is passed as
$from_encoding to mb_convert_encoding(), the array is modified
although it is not passed by reference.
This issue is fixed as of PHP 7.4.0.
Test script:
---------------
<?php
class Utf8Encoding
{
public function __toString()
{
return 'UTF-8';
}
}
$utf8encoding = new Utf8Encoding();
$encodings = [$utf8encoding];
var_dump($encodings);
mb_convert_encoding('foo', 'UTF-8', $encodings);
var_dump($encodings);
?>
Expected result:
----------------
array(1) {
[0]=>
object(Utf8Encoding)#1 (0) {
}
}
array(1) {
[0]=>
object(Utf8Encoding)#1 (0) {
}
}
Actual result:
--------------
array(1) {
[0]=>
object(Utf8Encoding)#1 (0) {
}
}
array(1) {
[0]=>
string(5) "UTF-8"
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79154&edit=1