Skip to content

Commit 6f00dd7

Browse files
committed
var_dump(): Don't skip recursion detection on first level
This is confusing. The current output doesn't make it clear that we're in fact recursing to the top-level structure.
1 parent 9e56502 commit 6f00dd7

File tree

7 files changed

+9
-38
lines changed

7 files changed

+9
-38
lines changed

Zend/tests/bug35163_2.phpt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,7 @@ array(3) {
1616
[0]=>
1717
int(2)
1818
[1]=>
19-
&array(3) {
20-
[0]=>
21-
int(2)
22-
[1]=>
23-
*RECURSION*
24-
[2]=>
25-
*RECURSION*
26-
}
19+
*RECURSION*
2720
[2]=>
28-
&array(3) {
29-
[0]=>
30-
int(2)
31-
[1]=>
32-
*RECURSION*
33-
[2]=>
34-
*RECURSION*
35-
}
21+
*RECURSION*
3622
}

Zend/tests/closure_026.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ array(1) {
4747
["this"]=>
4848
object(foo)#%d (1) {
4949
["a"]=>
50-
array(1) {
51-
[0]=>
52-
*RECURSION*
53-
}
50+
*RECURSION*
5451
}
5552
}
5653
}

Zend/tests/foreach_002.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,5 @@ foreach (($a = array('a' => array('a' => &$a))) as $a) {
1515
--EXPECT--
1616
array(1) {
1717
["a"]=>
18-
&array(1) {
19-
["a"]=>
20-
*RECURSION*
21-
}
18+
*RECURSION*
2219
}

Zend/tests/gc_004.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ echo "ok\n"
1414
--EXPECT--
1515
array(1) {
1616
[0]=>
17-
&array(1) {
18-
[0]=>
19-
*RECURSION*
20-
}
17+
*RECURSION*
2118
}
2219
int(1)
2320
ok

Zend/tests/gc_007.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ echo "ok\n"
1515
--EXPECT--
1616
array(1) {
1717
[0]=>
18-
&array(1) {
19-
[0]=>
20-
*RECURSION*
21-
}
18+
*RECURSION*
2219
}
2320
int(0)
2421
int(1)

Zend/tests/gc_010.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ echo "ok\n"
1515
--EXPECT--
1616
array(1) {
1717
[0]=>
18-
&array(1) {
19-
[0]=>
20-
*RECURSION*
21-
}
18+
*RECURSION*
2219
}
2320
int(1)
2421
ok

ext/standard/var.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ PHPAPI void php_var_dump(zval *struc, int level) /* {{{ */
123123
break;
124124
case IS_ARRAY:
125125
myht = Z_ARRVAL_P(struc);
126-
if (level > 1 && !(GC_FLAGS(myht) & GC_IMMUTABLE)) {
126+
if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) {
127127
if (GC_IS_RECURSIVE(myht)) {
128128
PUTS("*RECURSION*\n");
129129
return;
@@ -136,7 +136,7 @@ PHPAPI void php_var_dump(zval *struc, int level) /* {{{ */
136136
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, num, key, val) {
137137
php_array_element_dump(val, num, key, level);
138138
} ZEND_HASH_FOREACH_END();
139-
if (level > 1 && !(GC_FLAGS(myht) & GC_IMMUTABLE)) {
139+
if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) {
140140
GC_UNPROTECT_RECURSION(myht);
141141
}
142142
if (level > 1) {

0 commit comments

Comments
 (0)