This commit is contained in:
Sebastian Bergmann 2026-05-20 07:48:57 +02:00
parent 08b965bdef
commit 41cdd17bf0
No known key found for this signature in database
2 changed files with 16 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.
## [8.0.4] - 2026-MM-DD
### Changed
* [#57](https://github.com/sebastianbergmann/exporter/issues/57): Preserve `SplObjectStorage` iterator position instead of resetting to first element
## [8.0.3] - 2026-05-20
### Fixed
@ -48,6 +54,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* This component is no longer supported on PHP 8.2
[8.0.4]: https://github.com/sebastianbergmann/exporter/compare/8.0.3...main
[8.0.3]: https://github.com/sebastianbergmann/exporter/compare/8.0.2...8.0.3
[8.0.2]: https://github.com/sebastianbergmann/exporter/compare/8.0.1...8.0.2
[8.0.1]: https://github.com/sebastianbergmann/exporter/compare/8.0.0...8.0.1

View File

@ -230,6 +230,12 @@ final readonly class Exporter
// above (fast) mechanism nor with reflection in Zend.
// Format the output similarly to print_r() in this case
if ($value instanceof SplObjectStorage) {
$key = null;
if ($value->valid()) {
$key = $value->key();
}
foreach ($value as $_value) {
$array['Object #' . spl_object_id($_value)] = [
'obj' => $_value,
@ -237,7 +243,9 @@ final readonly class Exporter
];
}
$value->rewind();
if ($key !== null) {
$value->seek($key);
}
}
return $array;