xref: /PHP-8.1/ext/mbstring/tests/bug79154.phpt (revision 74859783)
1--TEST--
2Bug 79154 (mb_convert_encoding() can modify $from_encoding)
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7class Utf8Encoding
8{
9    public function __toString()
10    {
11        return 'UTF-8';
12    }
13}
14
15$utf8encoding = new Utf8Encoding();
16$encodings = [$utf8encoding];
17var_dump($encodings);
18mb_convert_encoding('foo', 'UTF-8', $encodings);
19var_dump($encodings);
20
21?>
22--EXPECTF--
23array(1) {
24  [0]=>
25  object(Utf8Encoding)#%d (0) {
26  }
27}
28array(1) {
29  [0]=>
30  object(Utf8Encoding)#%d (0) {
31  }
32}
33