xref: /PHP-8.0/ext/mbstring/tests/bug26639.phpt (revision 506f6a42)
1--TEST--
2Bug #26639 (mb_convert_variables() clutters variables beyond the references)
3--SKIPIF--
4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
5--FILE--
6<?php
7$a = "����������";
8$b = $a;
9mb_convert_variables("EUC-JP", "Shift_JIS", $b);
10debug_zval_dump($a);
11debug_zval_dump($b);
12unset($a);
13unset($b);
14
15$a = "����������";
16$b = &$a;
17mb_convert_variables("EUC-JP", "Shift_JIS", $b);
18debug_zval_dump($a);
19debug_zval_dump($b);
20unset($a);
21unset($b);
22
23$a = "����������";
24$b = array($a);
25$c = $b;
26mb_convert_variables("EUC-JP", "Shift_JIS", $c);
27debug_zval_dump($b);
28debug_zval_dump($c);
29unset($a);
30unset($b);
31unset($c);
32
33$a = "����������";
34$b = array(&$a);
35$c = $b;
36mb_convert_variables("EUC-JP", "Shift_JIS", $c);
37debug_zval_dump($b);
38debug_zval_dump($c);
39unset($a);
40unset($b);
41unset($c);
42
43$a = "����������";
44$b = array($a);
45$c = &$b;
46mb_convert_variables("EUC-JP", "Shift_JIS", $c);
47debug_zval_dump($b);
48debug_zval_dump($c);
49unset($a);
50unset($b);
51unset($c);
52
53$a = "����������";
54$b = array(&$a);
55$c = &$b;
56mb_convert_variables("EUC-JP", "Shift_JIS", $c);
57debug_zval_dump($b);
58debug_zval_dump($c);
59unset($a);
60unset($b);
61unset($c);
62
63$a = array(array("����������"));
64$b = $a;
65$c = $b;
66mb_convert_variables("EUC-JP", "Shift_JIS", $c);
67debug_zval_dump($b);
68debug_zval_dump($c);
69unset($a);
70unset($b);
71unset($c);
72?>
73--EXPECTF--
74string(10) "����������" refcount(%d)
75string(10) "����������" refcount(%d)
76string(10) "����������" refcount(%d)
77string(10) "����������" refcount(%d)
78array(1) refcount(%d){
79  [0]=>
80  string(10) "����������" refcount(%d)
81}
82array(1) refcount(%d){
83  [0]=>
84  string(10) "����������" refcount(%d)
85}
86array(1) refcount(%d){
87  [0]=>
88  &string(10) "����������" refcount(%d)
89}
90array(1) refcount(%d){
91  [0]=>
92  string(10) "����������" refcount(%d)
93}
94array(1) refcount(%d){
95  [0]=>
96  string(10) "����������" refcount(%d)
97}
98array(1) refcount(%d){
99  [0]=>
100  string(10) "����������" refcount(%d)
101}
102array(1) refcount(%d){
103  [0]=>
104  string(10) "����������" refcount(%d)
105}
106array(1) refcount(%d){
107  [0]=>
108  string(10) "����������" refcount(%d)
109}
110array(1) refcount(%d){
111  [0]=>
112  array(1) refcount(%d){
113    [0]=>
114    string(10) "����������" refcount(%d)
115  }
116}
117array(1) refcount(%d){
118  [0]=>
119  array(1) refcount(%d){
120    [0]=>
121    string(10) "����������" refcount(%d)
122  }
123}
124