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