mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
7485978339
This is an automated migration of most SKIPIF extension_loaded checks.
84 lines
1.3 KiB
PHP
84 lines
1.3 KiB
PHP
--TEST--
|
|
Bug #81011 (mb_convert_encoding removes references from arrays)
|
|
--EXTENSIONS--
|
|
mbstring
|
|
--FILE--
|
|
<?php
|
|
$array = [
|
|
'ads' => [
|
|
123 => ['name' => 'this', 'id' => 444],
|
|
234 => ['name' => 'that', 'id' => 555],
|
|
],
|
|
'other' => ['one', 'two']
|
|
];
|
|
|
|
// we modify array elements using reference
|
|
foreach( $array['ads'] as &$ad ){
|
|
$ad['premium'] = (int)($ad['id'] == 555);
|
|
}
|
|
|
|
var_dump($array);
|
|
var_dump(mb_convert_encoding($array, 'UTF-8', 'UTF-8'));
|
|
?>
|
|
--EXPECT--
|
|
array(2) {
|
|
["ads"]=>
|
|
array(2) {
|
|
[123]=>
|
|
array(3) {
|
|
["name"]=>
|
|
string(4) "this"
|
|
["id"]=>
|
|
int(444)
|
|
["premium"]=>
|
|
int(0)
|
|
}
|
|
[234]=>
|
|
&array(3) {
|
|
["name"]=>
|
|
string(4) "that"
|
|
["id"]=>
|
|
int(555)
|
|
["premium"]=>
|
|
int(1)
|
|
}
|
|
}
|
|
["other"]=>
|
|
array(2) {
|
|
[0]=>
|
|
string(3) "one"
|
|
[1]=>
|
|
string(3) "two"
|
|
}
|
|
}
|
|
array(2) {
|
|
["ads"]=>
|
|
array(2) {
|
|
[123]=>
|
|
array(3) {
|
|
["name"]=>
|
|
string(4) "this"
|
|
["id"]=>
|
|
int(444)
|
|
["premium"]=>
|
|
int(0)
|
|
}
|
|
[234]=>
|
|
array(3) {
|
|
["name"]=>
|
|
string(4) "that"
|
|
["id"]=>
|
|
int(555)
|
|
["premium"]=>
|
|
int(1)
|
|
}
|
|
}
|
|
["other"]=>
|
|
array(2) {
|
|
[0]=>
|
|
string(3) "one"
|
|
[1]=>
|
|
string(3) "two"
|
|
}
|
|
}
|