1--TEST-- 2Bug #81011 (mb_convert_encoding removes references from arrays) 3--EXTENSIONS-- 4mbstring 5--FILE-- 6<?php 7$array = [ 8 'ads' => [ 9 123 => ['name' => 'this', 'id' => 444], 10 234 => ['name' => 'that', 'id' => 555], 11 ], 12 'other' => ['one', 'two'] 13 ]; 14 15// we modify array elements using reference 16foreach( $array['ads'] as &$ad ){ 17 $ad['premium'] = (int)($ad['id'] == 555); 18} 19 20var_dump($array); 21var_dump(mb_convert_encoding($array, 'UTF-8', 'UTF-8')); 22?> 23--EXPECT-- 24array(2) { 25 ["ads"]=> 26 array(2) { 27 [123]=> 28 array(3) { 29 ["name"]=> 30 string(4) "this" 31 ["id"]=> 32 int(444) 33 ["premium"]=> 34 int(0) 35 } 36 [234]=> 37 &array(3) { 38 ["name"]=> 39 string(4) "that" 40 ["id"]=> 41 int(555) 42 ["premium"]=> 43 int(1) 44 } 45 } 46 ["other"]=> 47 array(2) { 48 [0]=> 49 string(3) "one" 50 [1]=> 51 string(3) "two" 52 } 53} 54array(2) { 55 ["ads"]=> 56 array(2) { 57 [123]=> 58 array(3) { 59 ["name"]=> 60 string(4) "this" 61 ["id"]=> 62 int(444) 63 ["premium"]=> 64 int(0) 65 } 66 [234]=> 67 array(3) { 68 ["name"]=> 69 string(4) "that" 70 ["id"]=> 71 int(555) 72 ["premium"]=> 73 int(1) 74 } 75 } 76 ["other"]=> 77 array(2) { 78 [0]=> 79 string(3) "one" 80 [1]=> 81 string(3) "two" 82 } 83} 84