1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00
Files
archived-php-src/ext/mbstring/tests/bug79154.phpt
Christoph M. Becker 9be31a582a Fix #79154: mb_convert_encoding() can modify $from_encoding
We must not modify arrays passed by value.
2020-01-22 10:28:07 +01:00

35 lines
562 B
PHP

--TEST--
Bug 79154 (mb_convert_encoding() can modify $from_encoding)
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('mbstring extension not available');
?>
--FILE--
<?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);
?>
--EXPECTF--
array(1) {
[0]=>
object(Utf8Encoding)#%d (0) {
}
}
array(1) {
[0]=>
object(Utf8Encoding)#%d (0) {
}
}