This commit is contained in:
Sebastian Bergmann 2024-06-18 08:31:36 +02:00
parent f2788021e5
commit 7eb922f18c
No known key found for this signature in database
GPG Key ID: 4AA394086372C20A
3 changed files with 26 additions and 1 deletions

View File

@ -2,6 +2,12 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [6.1.1] - 2024-06-18
### Fixed
* [#61](https://github.com/sebastianbergmann/exporter/issues/61): `count(): Recursion detected` warning triggered
## [6.1.0] - 2024-06-18
### Added
@ -134,6 +140,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* Remove HHVM-specific code that is no longer needed
[6.1.1]: https://github.com/sebastianbergmann/exporter/compare/6.1.0...6.1.1
[6.1.0]: https://github.com/sebastianbergmann/exporter/compare/6.0.3...6.1.0
[6.0.3]: https://github.com/sebastianbergmann/exporter/compare/fe0dca49a60d34440e2f086951952dd13aa9a5d2...6.0.3
[6.0.2]: https://github.com/sebastianbergmann/exporter/compare/6.0.1...fe0dca49a60d34440e2f086951952dd13aa9a5d2

View File

@ -76,7 +76,7 @@ final readonly class Exporter
$processed = new RecursionContext;
}
$overallCount = count($data, COUNT_RECURSIVE);
$overallCount = @count($data, COUNT_RECURSIVE);
$counter = 0;
$export = $this->shortenedCountedRecursiveExport($data, $processed, $counter);

View File

@ -63,6 +63,9 @@ final class ExporterTest extends TestCase
$resource = fopen('php://memory', 'r');
fclose($resource);
$recursiveArray = [];
$recursiveArray[0] = &$recursiveArray;
return [
'null' => [null, 'null', 0],
'boolean true' => [true, 'true', 0],
@ -273,6 +276,17 @@ EOF,
'SebastianBergmann\Exporter\ExampleIntegerBackedEnum Enum #%d (Value, 0)',
0,
],
'recursive array' => [
$recursiveArray,
<<<'EOF'
Array &0 [
0 => Array &1 [
0 => Array &1,
],
]
EOF,
0,
],
];
}
@ -285,6 +299,9 @@ EOF,
'foo' => 'bar',
];
$recursiveArray = [];
$recursiveArray[0] = &$recursiveArray;
return [
'null' => [null, 'null'],
'boolean true' => [true, 'true'],
@ -307,6 +324,7 @@ EOF,
'enum' => [ExampleEnum::Value, 'SebastianBergmann\Exporter\ExampleEnum Enum (Value)'],
'backed enum (string)' => [ExampleStringBackedEnum::Value, 'SebastianBergmann\Exporter\ExampleStringBackedEnum Enum (Value, \'value\')'],
'backen enum (integer)' => [ExampleIntegerBackedEnum::Value, 'SebastianBergmann\Exporter\ExampleIntegerBackedEnum Enum (Value, 0)'],
'recursive array' => [$recursiveArray, '[...]', 0],
];
}