]> granicus.if.org Git - php/commitdiff
var_dump(): Don't skip recursion detection on first level
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 12 Feb 2020 09:27:28 +0000 (10:27 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 12 Feb 2020 10:25:50 +0000 (11:25 +0100)
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.

13 files changed:
Zend/tests/bug35163_2.phpt
Zend/tests/closure_026.phpt
Zend/tests/foreach_002.phpt
Zend/tests/gc_004.phpt
Zend/tests/gc_007.phpt
Zend/tests/gc_010.phpt
ext/json/tests/003.phpt
ext/mbstring/tests/bug66964.phpt
ext/standard/tests/array/array_map_variation2.phpt
ext/standard/tests/array/natcasesort_variation7.phpt
ext/standard/tests/serialize/serialization_arrays_004.phpt
ext/standard/tests/serialize/serialization_arrays_005.phpt
ext/standard/var.c

index 01387204c82de4a498a4699fbf0c87b1b1574838..81bf853266d0a4f1240c171e2ffcc392080e979e 100644 (file)
@@ -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*
 }
index 62702a5e03d6cdadac312a7432aeb95262af164c..0dba62fcb9a1690e4f9af78e3f8644d57d35945d 100644 (file)
@@ -47,10 +47,7 @@ array(1) {
     ["this"]=>
     object(foo)#%d (1) {
       ["a"]=>
-      array(1) {
-        [0]=>
-        *RECURSION*
-      }
+      *RECURSION*
     }
   }
 }
index 2daa48c3f6b55b0b85a4263c06e36f1e8dca07ab..23e21d640bc2ea8c176327a9a53bdaa9acecea74 100644 (file)
@@ -15,8 +15,5 @@ foreach (($a = array('a' => array('a' => &$a))) as $a) {
 --EXPECT--
 array(1) {
   ["a"]=>
-  &array(1) {
-    ["a"]=>
-    *RECURSION*
-  }
+  *RECURSION*
 }
index 1b6f70abe6803a3d14d955dd18d4bebfe6afe683..714ad6aa9b4d9ed4ff5a5183f68162d10058d050 100644 (file)
@@ -14,10 +14,7 @@ echo "ok\n"
 --EXPECT--
 array(1) {
   [0]=>
-  &array(1) {
-    [0]=>
-    *RECURSION*
-  }
+  *RECURSION*
 }
 int(1)
 ok
index a018e4846df6edff6910a32a5f32af9db1fd0902..d7a548aff99c757334ac4c4f4138dfcee6c009c1 100644 (file)
@@ -15,10 +15,7 @@ echo "ok\n"
 --EXPECT--
 array(1) {
   [0]=>
-  &array(1) {
-    [0]=>
-    *RECURSION*
-  }
+  *RECURSION*
 }
 int(0)
 int(1)
index af2dda3fe1ee3db62263d0e69735505ead064bd9..756c8ebc2a7a8694c04cfc2aec634da8c8ba7e37 100644 (file)
@@ -15,10 +15,7 @@ echo "ok\n"
 --EXPECT--
 array(1) {
   [0]=>
-  &array(1) {
-    [0]=>
-    *RECURSION*
-  }
+  *RECURSION*
 }
 int(1)
 ok
index 3248689bf94d0628a7f69d241c7cb775b2c5cae9..e0a5e469787c461b52c11c5fae6d618504bb5814 100644 (file)
@@ -25,10 +25,7 @@ echo "Done\n";
 --EXPECTF--
 array(1) {
   [0]=>
-  &array(1) {
-    [0]=>
-    *RECURSION*
-  }
+  *RECURSION*
 }
 
 bool(false)
index c33bb67c49e20b009371244b0c2adc33aad19e72..b4e87a6ae1ba019baf241616dcb640340e00dcb7 100644 (file)
@@ -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*
 }
index b7d22e0825bd2e5d953a947d074a344442bf739f..79eef00fc4f48d5e4389273882bfbb67de45f3ec 100644 (file)
@@ -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]=>
index 713f7c959c66985be306136ea5f3f48b599ff566..fb731b101c7a64e2364cad57fed26dba422f33bc 100644 (file)
@@ -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"
 }
index e2e383ef82af3c635df6c2cf83b377b992cb349e..b3d630ecf47c4a132354f2a90d7309321eeb7ffa 100644 (file)
@@ -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) {
index b1f300b308b0f514c090d91823eab27cb61aa5e8..93e3ae513560c3433f3c83462ac06680ca243864 100644 (file)
@@ -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;}}}"
index 70a70b0f6e95756bcada866a767a124c196f79ca..3f7db8faafd660a813af93f1bfd0791cb45477c6 100644 (file)
@@ -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) {