Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge 71ab04d into 83568db
Browse files Browse the repository at this point in the history
  • Loading branch information
michalbundyra committed Dec 24, 2018
2 parents 83568db + 71ab04d commit d6b5d75
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Expand Up @@ -22,7 +22,10 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- Nothing.
- [#96](https://github.com/zendframework/zend-hydrator/pull/96) fixes
issue with integer keys in `ArraySerializableHydrator`. Keys are
now casted to strings as we have strict type declaration in the
library.

## 3.0.0 - 2018-12-10

Expand Down
2 changes: 2 additions & 0 deletions src/ArraySerializableHydrator.php
Expand Up @@ -36,6 +36,8 @@ public function extract(object $object) : array
$filter = $this->getFilter();

foreach ($data as $name => $value) {
$name = (string) $name;

if (! $filter->filter($name)) {
unset($data[$name]);
continue;
Expand Down
14 changes: 14 additions & 0 deletions test/ArraySerializableHydratorTest.php
Expand Up @@ -9,6 +9,7 @@

namespace ZendTest\Hydrator;

use ArrayObject;
use PHPUnit\Framework\TestCase;
use TypeError;
use Zend\Hydrator\ArraySerializableHydrator;
Expand Down Expand Up @@ -169,4 +170,17 @@ public function testHydrationWillReplaceNestedArrayData($start, $submit, $expect

$this->assertSame($expected, $final['tags']);
}

public function testExtractArrayObject()
{
$arrayObject = new ArrayObject([
'value1',
'value2',
'value3',
]);

$data = $this->hydrator->extract($arrayObject);

$this->assertSame(['value1', 'value2', 'value3'], $data);
}
}

0 comments on commit d6b5d75

Please sign in to comment.