Skip to content

Commit ab84617

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79154: mb_convert_encoding() can modify $from_encoding
2 parents 94c9dc4 + 9be31a5 commit ab84617

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

ext/mbstring/tests/bug79154.phpt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
--TEST--
2+
Bug 79154 (mb_convert_encoding() can modify $from_encoding)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('mbstring')) die('mbstring extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
class Utf8Encoding
10+
{
11+
public function __toString()
12+
{
13+
return 'UTF-8';
14+
}
15+
}
16+
17+
$utf8encoding = new Utf8Encoding();
18+
$encodings = [$utf8encoding];
19+
var_dump($encodings);
20+
mb_convert_encoding('foo', 'UTF-8', $encodings);
21+
var_dump($encodings);
22+
23+
?>
24+
--EXPECTF--
25+
array(1) {
26+
[0]=>
27+
object(Utf8Encoding)#%d (0) {
28+
}
29+
}
30+
array(1) {
31+
[0]=>
32+
object(Utf8Encoding)#%d (0) {
33+
}
34+
}

0 commit comments

Comments
 (0)