Re: Allow empty property names

From: Date: Fri, 25 Mar 2016 23:16:45 +0000
Subject: Re: Allow empty property names
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-91959@lists.php.net to get a copy of this message
Hi Yasuo, On 26 March 2016 at 00:08, Yasuo Ohgaki <yohgaki@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/

« previous php.internals (#91959) next »