Hi Yasuo,

On 26 March 2016 at 00:08, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:

> > Not suggesting allowing "\0" for property names: the example just shows
> > creating a public, private and protected property with an empty name.
>
> Could you show some real world example use cases?
>

I've been using the "\0<scope>\0" approach in a few codegen-related
projects, specifically in ProxyManager (
https://github.com/Ocramius/ProxyManager/blob/master/docs/lazy-loading-ghost-object.md#lazy-initialization-properties-explained
) and GeneratedHydrator ( https://github.com/Ocramius/GeneratedHydrator ).

No user input values involved, though.

See
https://github.com/php/php-src/blob/d3ed75b9ebc998b8cf325e0e3ab954bd10989918/tests/classes/array_conversion_keys.phpt
for the tests inside php-src: the inverse cast is not covered by tests,
though, as there is really little to no use-case for an `stdClass` with
private or protected properties, unless the only purpose is casting it back
into an array.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

Reply via email to