bug #38442 [VarDumper] fix truncating big arrays (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[VarDumper] fix truncating big arrays

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  |
| Deprecations? | no
| Tickets       | Fix #38428
| License       | MIT
| Doc PR        | -

Commits
-------

a8b986e35e [VarDumper] fix truncating big arrays
This commit is contained in:
Fabien Potencier 2020-10-07 07:50:22 +02:00
commit c4aeb6fd80
2 changed files with 4 additions and 4 deletions

View File

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

View File

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