ObjectProperty Hydrator should only hydrate public properties (fix + new test)

According to the docs, the Zend\Stdlib\Hydrator\ObjectProperty hydrator hydrates "Any data key matching a publicly accessible property will be hydrated; any public properties will be used for extraction."

No Test was found directly for this Hydrator and the Hydrator itself would attempt to set private or protected properties resulting in a fatal error. 
To this end, I have:
1. submitted the fix to only hydrate public properties
2. have created a test for the hydrator

I hope that this meets guidelines for this.
wouldn't work as the array has the \0 version, not the property in
iteration
On 22 Nov 2014 07:56, "Marco Pivetta" <notifications@github.com> wrote:

> In library/Zend/Stdlib/Hydrator/ObjectProperty.php:
>
> > @@ -68,8 +68,20 @@ public function hydrate(array $data, $object)
> >                  '%s expects the provided $object to be a PHP object)', __METHOD__
> >              ));
> >          }
> > +
> > +        $propertyList = (array)$object;
> > +        $privatePropertyPrefix = "\0" . get_class($object) . "\0";
> > +        $protectedPropertyPrefix = "\0*\0";
>
> You can just look for any property starting with "\0": that is enough to
> decide to skip them.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/zendframework/zf2/pull/6869/files#r20755730>.
>