mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
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. Closes GH-5171.
This commit is contained in:
parent
9e5650265c
commit
ae6f45ad45
13 changed files with 23 additions and 164 deletions
|
@ -16,21 +16,7 @@ array(3) {
|
|||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
|
|
|
@ -47,10 +47,7 @@ array(1) {
|
|||
["this"]=>
|
||||
object(foo)#%d (1) {
|
||||
["a"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,5 @@ foreach (($a = array('a' => array('a' => &$a))) as $a) {
|
|||
--EXPECT--
|
||||
array(1) {
|
||||
["a"]=>
|
||||
&array(1) {
|
||||
["a"]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
|
|
|
@ -14,10 +14,7 @@ echo "ok\n"
|
|||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
&array(1) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
int(1)
|
||||
ok
|
||||
|
|
|
@ -15,10 +15,7 @@ echo "ok\n"
|
|||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
&array(1) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
int(0)
|
||||
int(1)
|
||||
|
|
|
@ -15,10 +15,7 @@ echo "ok\n"
|
|||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
&array(1) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
int(1)
|
||||
ok
|
||||
|
|
|
@ -25,10 +25,7 @@ echo "Done\n";
|
|||
--EXPECTF--
|
||||
array(1) {
|
||||
[0]=>
|
||||
&array(1) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
|
||||
bool(false)
|
||||
|
|
|
@ -49,16 +49,5 @@ array(5) {
|
|||
[3]=>
|
||||
string(21) "日本語テキスト"
|
||||
[4]=>
|
||||
&array(5) {
|
||||
[0]=>
|
||||
string(21) "日本語テキスト"
|
||||
[1]=>
|
||||
string(21) "日本語テキスト"
|
||||
[2]=>
|
||||
string(21) "日本語テキスト"
|
||||
[3]=>
|
||||
string(21) "日本語テキスト"
|
||||
[4]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
|
|
|
@ -38,16 +38,7 @@ array(4) {
|
|||
[0]=>
|
||||
&string(2) "v1"
|
||||
[1]=>
|
||||
&array(4) {
|
||||
["k1"]=>
|
||||
&string(2) "v1"
|
||||
["k2"]=>
|
||||
string(2) "v2"
|
||||
[0]=>
|
||||
&string(2) "v1"
|
||||
[1]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
array(4) {
|
||||
["k1"]=>
|
||||
|
@ -91,16 +82,7 @@ array(4) {
|
|||
[0]=>
|
||||
&string(2) "v1"
|
||||
[1]=>
|
||||
&array(4) {
|
||||
["k1"]=>
|
||||
&string(2) "v1"
|
||||
["k2"]=>
|
||||
string(2) "v2"
|
||||
[0]=>
|
||||
&string(2) "v1"
|
||||
[1]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
|
@ -141,16 +123,7 @@ array(4) {
|
|||
[0]=>
|
||||
&string(2) "v1"
|
||||
[1]=>
|
||||
&array(4) {
|
||||
["k1"]=>
|
||||
&string(2) "v1"
|
||||
["k2"]=>
|
||||
string(2) "v2"
|
||||
[0]=>
|
||||
&string(2) "v1"
|
||||
[1]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
array(4) {
|
||||
[0]=>
|
||||
|
|
|
@ -34,18 +34,7 @@ array(5) {
|
|||
[3]=>
|
||||
string(1) "2"
|
||||
[4]=>
|
||||
&array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
float(3)
|
||||
[2]=>
|
||||
string(4) "zero"
|
||||
[3]=>
|
||||
string(1) "2"
|
||||
[4]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
bool(true)
|
||||
array(5) {
|
||||
|
@ -56,18 +45,7 @@ array(5) {
|
|||
[1]=>
|
||||
float(3)
|
||||
[4]=>
|
||||
&array(5) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[3]=>
|
||||
string(1) "2"
|
||||
[1]=>
|
||||
float(3)
|
||||
[4]=>
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
string(4) "zero"
|
||||
}
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
string(4) "zero"
|
||||
}
|
||||
|
|
|
@ -55,14 +55,7 @@ echo "Done";
|
|||
--- 1 refs container:
|
||||
array(3) {
|
||||
[0]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
[1]=>
|
||||
int(1)
|
||||
[2]=>
|
||||
int(1)
|
||||
}
|
||||
*RECURSION*
|
||||
[1]=>
|
||||
int(1)
|
||||
[2]=>
|
||||
|
@ -113,23 +106,9 @@ array(3) {
|
|||
--- 1,2 ref container:
|
||||
array(3) {
|
||||
[0]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
[1]=>
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
int(1)
|
||||
}
|
||||
*RECURSION*
|
||||
[1]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
[1]=>
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
int(1)
|
||||
}
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
int(1)
|
||||
}
|
||||
|
@ -185,32 +164,11 @@ array(3) {
|
|||
--- 1,2,3 ref container:
|
||||
array(3) {
|
||||
[0]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
[1]=>
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
[1]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
[1]=>
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
*RECURSION*
|
||||
[1]=>
|
||||
*RECURSION*
|
||||
[2]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;R:2;i:2;R:2;}i:1;R:2;i:2;R:2;}"
|
||||
array(3) {
|
||||
|
|
|
@ -435,14 +435,7 @@ array(3) {
|
|||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
&array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(1)
|
||||
[2]=>
|
||||
*RECURSION*
|
||||
}
|
||||
*RECURSION*
|
||||
}
|
||||
}
|
||||
string(74) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;i:1;i:1;a:3:{i:0;i:1;i:1;i:1;i:2;R:4;}}}"
|
||||
|
|
|
@ -123,7 +123,7 @@ again:
|
|||
break;
|
||||
case IS_ARRAY:
|
||||
myht = Z_ARRVAL_P(struc);
|
||||
if (level > 1 && !(GC_FLAGS(myht) & GC_IMMUTABLE)) {
|
||||
if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) {
|
||||
if (GC_IS_RECURSIVE(myht)) {
|
||||
PUTS("*RECURSION*\n");
|
||||
return;
|
||||
|
@ -136,7 +136,7 @@ again:
|
|||
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, num, key, val) {
|
||||
php_array_element_dump(val, num, key, level);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
if (level > 1 && !(GC_FLAGS(myht) & GC_IMMUTABLE)) {
|
||||
if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) {
|
||||
GC_UNPROTECT_RECURSION(myht);
|
||||
}
|
||||
if (level > 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue