[VarDumper] fix truncating big arrays

This commit is contained in:
Nicolas Grekas 2020-10-06 18:40:22 +02:00
parent f4a1885b8d
commit a8b986e35e
2 changed files with 4 additions and 4 deletions

View File

@ -247,7 +247,7 @@ class VarCloner extends AbstractCloner
$stub->position = $len++; $stub->position = $len++;
} elseif ($pos < $maxItems) { } elseif ($pos < $maxItems) {
if ($maxItems < $pos += \count($a)) { if ($maxItems < $pos += \count($a)) {
$a = \array_slice($a, 0, $maxItems - $pos); $a = \array_slice($a, 0, $maxItems - $pos, true);
if ($stub->cut >= 0) { if ($stub->cut >= 0) {
$stub->cut += $pos - $maxItems; $stub->cut += $pos - $maxItems;
} }

View File

@ -162,7 +162,7 @@ EOTXT;
'Level 3 Item 3', 'Level 3 Item 3',
], ],
[ [
'Level 3 Item 4', 999 => 'Level 3 Item 4',
'Level 3 Item 5', 'Level 3 Item 5',
'Level 3 Item 6', 'Level 3 Item 6',
], ],
@ -242,7 +242,7 @@ Symfony\Component\VarDumper\Cloner\Data Object
[1] => Array [1] => Array
( (
[0] => 2 [0] => 2
[2] => 7 [1] => 7
) )
[2] => Array [2] => Array
@ -299,7 +299,7 @@ Symfony\Component\VarDumper\Cloner\Data Object
[7] => Array [7] => Array
( (
[0] => Level 3 Item 4 [999] => Level 3 Item 4
) )
) )