Skip to content

Commit e2c8ab7

Browse files
committed
Print "interned" instead of fake refcount in debug_zval_dump()
debug_zval_dump() currently prints refcount 1 for interned strings and arrays, which does not really reflect the truth. These values are not refcounted, so the refcount is misleading. Instead print an "interned" tag. Closes phpGH-6598.
1 parent 869221c commit e2c8ab7

15 files changed

+122
-109
lines changed

ext/mbstring/tests/bug26639.phpt

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@ Bug #26639 (mb_convert_variables() clutters variables beyond the references)
77
$a = "あいうえお";
88
$b = $a;
99
mb_convert_variables("EUC-JP", "Shift_JIS", $b);
10-
debug_zval_dump($a);
11-
debug_zval_dump($b);
10+
var_dump($a);
11+
var_dump($b);
1212
unset($a);
1313
unset($b);
1414

1515
$a = "あいうえお";
1616
$b = &$a;
1717
mb_convert_variables("EUC-JP", "Shift_JIS", $b);
18-
debug_zval_dump($a);
19-
debug_zval_dump($b);
18+
var_dump($a);
19+
var_dump($b);
2020
unset($a);
2121
unset($b);
2222

2323
$a = "あいうえお";
2424
$b = array($a);
2525
$c = $b;
2626
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
27-
debug_zval_dump($b);
28-
debug_zval_dump($c);
27+
var_dump($b);
28+
var_dump($c);
2929
unset($a);
3030
unset($b);
3131
unset($c);
@@ -34,8 +34,8 @@ $a = "
3434
$b = array(&$a);
3535
$c = $b;
3636
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
37-
debug_zval_dump($b);
38-
debug_zval_dump($c);
37+
var_dump($b);
38+
var_dump($c);
3939
unset($a);
4040
unset($b);
4141
unset($c);
@@ -44,8 +44,8 @@ $a = "
4444
$b = array($a);
4545
$c = &$b;
4646
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
47-
debug_zval_dump($b);
48-
debug_zval_dump($c);
47+
var_dump($b);
48+
var_dump($c);
4949
unset($a);
5050
unset($b);
5151
unset($c);
@@ -54,8 +54,8 @@ $a = "
5454
$b = array(&$a);
5555
$c = &$b;
5656
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
57-
debug_zval_dump($b);
58-
debug_zval_dump($c);
57+
var_dump($b);
58+
var_dump($c);
5959
unset($a);
6060
unset($b);
6161
unset($c);
@@ -64,60 +64,60 @@ $a = array(array("
6464
$b = $a;
6565
$c = $b;
6666
mb_convert_variables("EUC-JP", "Shift_JIS", $c);
67-
debug_zval_dump($b);
68-
debug_zval_dump($c);
67+
var_dump($b);
68+
var_dump($c);
6969
unset($a);
7070
unset($b);
7171
unset($c);
7272
?>
73-
--EXPECTF--
74-
string(10) "あいうえお" refcount(%d)
75-
string(10) "、「、、、ヲ、ィ、ェ" refcount(%d)
76-
string(10) "、「、、、ヲ、ィ、ェ" refcount(%d)
77-
string(10) "、「、、、ヲ、ィ、ェ" refcount(%d)
78-
array(1) refcount(%d){
73+
--EXPECT--
74+
string(10) "あいうえお"
75+
string(10) "、「、、、ヲ、ィ、ェ"
76+
string(10) "、「、、、ヲ、ィ、ェ"
77+
string(10) "、「、、、ヲ、ィ、ェ"
78+
array(1) {
7979
[0]=>
80-
string(10) "あいうえお" refcount(%d)
80+
string(10) "あいうえお"
8181
}
82-
array(1) refcount(%d){
82+
array(1) {
8383
[0]=>
84-
string(10) "、「、、、ヲ、ィ、ェ" refcount(%d)
84+
string(10) "、「、、、ヲ、ィ、ェ"
8585
}
86-
array(1) refcount(%d){
86+
array(1) {
8787
[0]=>
88-
&string(10) "あいうえお" refcount(%d)
88+
&string(10) "あいうえお"
8989
}
90-
array(1) refcount(%d){
90+
array(1) {
9191
[0]=>
92-
string(10) "、「、、、ヲ、ィ、ェ" refcount(%d)
92+
string(10) "、「、、、ヲ、ィ、ェ"
9393
}
94-
array(1) refcount(%d){
94+
array(1) {
9595
[0]=>
96-
string(10) "、「、、、ヲ、ィ、ェ" refcount(%d)
96+
string(10) "、「、、、ヲ、ィ、ェ"
9797
}
98-
array(1) refcount(%d){
98+
array(1) {
9999
[0]=>
100-
string(10) "、「、、、ヲ、ィ、ェ" refcount(%d)
100+
string(10) "、「、、、ヲ、ィ、ェ"
101101
}
102-
array(1) refcount(%d){
102+
array(1) {
103103
[0]=>
104-
string(10) "、「、、、ヲ、ィ、ェ" refcount(%d)
104+
string(10) "、「、、、ヲ、ィ、ェ"
105105
}
106-
array(1) refcount(%d){
106+
array(1) {
107107
[0]=>
108-
string(10) "、「、、、ヲ、ィ、ェ" refcount(%d)
108+
string(10) "、「、、、ヲ、ィ、ェ"
109109
}
110-
array(1) refcount(%d){
110+
array(1) {
111111
[0]=>
112-
array(1) refcount(%d){
112+
array(1) {
113113
[0]=>
114-
string(10) "あいうえお" refcount(%d)
114+
string(10) "あいうえお"
115115
}
116116
}
117-
array(1) refcount(%d){
117+
array(1) {
118118
[0]=>
119-
array(1) refcount(%d){
119+
array(1) {
120120
[0]=>
121-
string(10) "、「、、、ヲ、ィ、ェ" refcount(%d)
121+
string(10) "、「、、、ヲ、ィ、ェ"
122122
}
123123
}

ext/mysqli/tests/mysqli_result_references.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ References to result sets
55
require_once('skipif.inc');
66
require_once('skipifconnectfailure.inc');
77
?>
8+
--INI--
9+
opcache.enable=0
810
--FILE--
911
<?php
1012
require_once('connect.inc');
@@ -136,9 +138,9 @@ array(1) refcount(2){
136138
[0]=>
137139
array(2) refcount(1){
138140
["id"]=>
139-
string(1) "1" refcount(%d)
141+
string(1) "1" interned
140142
["label"]=>
141-
string(1) "a" refcount(%d)
143+
string(1) "a" interned
142144
}
143145
}
144146
done!

ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ array(1) refcount(%d){
5959
["row_copy"]=>
6060
array(2) refcount(1){
6161
["id"]=>
62-
string(1) "1" refcount(%d)
62+
string(1) "1" interned
6363
["label"]=>
64-
string(1) "a" refcount(%d)
64+
string(1) "a" interned
6565
}
6666
["id_ref"]=>
67-
string(1) "1" refcount(%d)
67+
string(1) "1" interned
6868
["id_copy"]=>
69-
string(1) "1" refcount(%d)
69+
string(1) "1" interned
7070
}
7171
}
7272
array(2) refcount(%d){
@@ -77,35 +77,35 @@ array(2) refcount(%d){
7777
["row_copy"]=>
7878
array(2) refcount(%d){
7979
["id"]=>
80-
string(1) "1" refcount(%d)
80+
string(1) "1" interned
8181
["label"]=>
82-
string(1) "a" refcount(%d)
82+
string(1) "a" interned
8383
}
8484
["id_ref"]=>
85-
string(1) "1" refcount(%d)
85+
string(1) "1" interned
8686
["id_copy"]=>
87-
string(1) "1" refcount(%d)
87+
string(1) "1" interned
8888
}
8989
[1]=>
9090
array(5) refcount(%d){
9191
["row_ref"]=>
9292
&array(2) refcount(%d){
9393
["id"]=>
94-
&string(1) "2" refcount(%d)
94+
&string(1) "2" interned
9595
["label"]=>
96-
string(1) "b" refcount(%d)
96+
string(1) "b" interned
9797
}
9898
["row_copy"]=>
9999
array(2) refcount(%d){
100100
["id"]=>
101-
string(1) "2" refcount(%d)
101+
string(1) "2" interned
102102
["label"]=>
103-
string(1) "b" refcount(%d)
103+
string(1) "b" interned
104104
}
105105
["id_ref"]=>
106-
&string(1) "2" refcount(%d)
106+
&string(1) "2" interned
107107
["id_copy"]=>
108-
string(1) "2" refcount(%d)
108+
string(1) "2" interned
109109
["id_copy_mod"]=>
110110
int(2)
111111
}

ext/standard/tests/array/bug24766.phpt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,35 @@ error_reporting(E_ALL);
77

88
$a = unpack('C2', "\0224V");
99
$b = array(1 => 18, 2 => 52);
10-
debug_zval_dump($a, $b);
10+
var_dump($a, $b);
1111
$k = array_keys($a);
1212
$l = array_keys($b);
13-
debug_zval_dump($k, $l);
13+
var_dump($k, $l);
1414
$i=$k[0];
1515
var_dump($a[$i]);
1616
$i=$l[0];
1717
var_dump($b[$i]);
1818
?>
19-
--EXPECTF--
20-
array(2) refcount(%d){
19+
--EXPECT--
20+
array(2) {
2121
[1]=>
2222
int(18)
2323
[2]=>
2424
int(52)
2525
}
26-
array(2) refcount(%d){
26+
array(2) {
2727
[1]=>
2828
int(18)
2929
[2]=>
3030
int(52)
3131
}
32-
array(2) refcount(%d){
32+
array(2) {
3333
[0]=>
3434
int(1)
3535
[1]=>
3636
int(2)
3737
}
38-
array(2) refcount(%d){
38+
array(2) {
3939
[0]=>
4040
int(1)
4141
[1]=>

ext/standard/tests/array/bug25708.phpt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,33 @@ function foo($ref, $alt) {
2121
$b = NULL;
2222
}
2323

24-
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
24+
var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
2525
echo "--\n";
2626
if ($alt) {
2727
$a = &$GLOBALS['a'];
2828
$b = &$GLOBALS['b'];
2929
} else {
3030
extract($GLOBALS, EXTR_REFS);
3131
}
32-
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
32+
var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
3333
echo "--\n";
3434
$a = &$GLOBALS['a'];
3535
$b = &$GLOBALS['b'];
36-
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
36+
var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
3737
echo "--\n";
3838
$GLOBALS['b'] = 3;
39-
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
39+
var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
4040
echo "--\n";
4141
$a = 4;
42-
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
42+
var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
4343
echo "--\n";
4444
$c = $b;
45-
debug_zval_dump($b, $GLOBALS['b'], $c);
45+
var_dump($b, $GLOBALS['b'], $c);
4646
echo "--\n";
4747
$b = 'x';
48-
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b'], $c);
48+
var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b'], $c);
4949
echo "--\n";
50-
debug_zval_dump($org_a, $org_b);
50+
var_dump($org_a, $org_b);
5151
echo "----";
5252
if ($ref) echo 'r';
5353
if ($alt) echo 'a';
@@ -64,9 +64,9 @@ foo(true, true);
6464
foo(false, false);
6565
foo(true, false);
6666

67-
debug_zval_dump($_a, $_b);
67+
var_dump($_a, $_b);
6868
?>
69-
--EXPECTF--
69+
--EXPECT--
7070
NULL
7171
NULL
7272
int(1)
@@ -97,9 +97,9 @@ int(3)
9797
int(3)
9898
--
9999
int(4)
100-
string(1) "x" refcount(%d)
100+
string(1) "x"
101101
int(4)
102-
string(1) "x" refcount(%d)
102+
string(1) "x"
103103
int(3)
104104
--
105105
int(1)
@@ -135,9 +135,9 @@ int(3)
135135
int(3)
136136
--
137137
int(4)
138-
string(1) "x" refcount(%d)
138+
string(1) "x"
139139
int(4)
140-
string(1) "x" refcount(%d)
140+
string(1) "x"
141141
int(3)
142142
--
143143
int(1)
@@ -173,9 +173,9 @@ int(3)
173173
int(3)
174174
--
175175
int(4)
176-
string(1) "x" refcount(%d)
176+
string(1) "x"
177177
int(4)
178-
string(1) "x" refcount(%d)
178+
string(1) "x"
179179
int(3)
180180
--
181181
int(1)
@@ -211,13 +211,13 @@ int(3)
211211
int(3)
212212
--
213213
int(4)
214-
string(1) "x" refcount(%d)
214+
string(1) "x"
215215
int(4)
216-
string(1) "x" refcount(%d)
216+
string(1) "x"
217217
int(3)
218218
--
219219
int(1)
220220
int(2)
221221
----r
222-
string(2) "ok" refcount(%d)
223-
string(2) "ok" refcount(%d)
222+
string(2) "ok"
223+
string(2) "ok"
-20 Bytes
Binary file not shown.

ext/standard/tests/array/bug72369.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ debug_zval_dump($a);
1212
--EXPECTF--
1313
array(1) refcount(%d){
1414
["test"]=>
15-
string(3) "xxx" refcount(%d)
15+
string(3) "xxx" interned
1616
}

0 commit comments

Comments
 (0)