Re: [PHP-DEV] vsprintf()

2013-04-25 Thread Johannes Schlüter
On Wed, 2013-04-24 at 12:54 -0500, Ralph Schindler wrote: > > > I must have left the public in there when I posted it to twitter. > I'd > have to say it's a little unintuitive when the properties are > protected, > but all in all, I don't dislike the behavior. Perhaps this just > needs > to b

Re: [PHP-DEV] vsprintf()

2013-04-24 Thread Rasmus Schultz
Frankly, a magic method sounds like a much better solution than auto-magically converting objects to arrays. The problem with automatic conversion, is that the order of properties is an implementation detail - the vsprintf() example perfectly illustrates the problem: class User { public $firs

Re: [PHP-DEV] vsprintf()

2013-04-24 Thread Ralph Schindler
Well, since I was the one who posted it (https://twitter.com/ralphschindler/status/327084619507855361), I'll further explain it. I realized it was doing this when actually running this kind of snippet: http://3v4l.org/ZkE6B I must have left the public in there when I posted it to twitter. I

Re: [PHP-DEV] vsprintf()

2013-04-24 Thread Anthony Ferrara
Richard, Oh! Another magic method opportunity ... > > /** > * Operates just like __toString(), but returns an array. > */ > public function __toArray(); > > > (ducking) I know you're joking, but this has been brought up before (and I intend to bring it up again): https://wiki.php.net/rfc/obje

Re: [PHP-DEV] vsprintf()

2013-04-24 Thread Richard Quadling
On 24 April 2013 17:31, Richard Bradley wrote: > > -Original Message- > > From: Rasmus Schultz [mailto:ras...@mindplay.dk] > > Sent: 24 April 2013 16:45 > > To: PHP internals > > Subject: [PHP-DEV] vsprintf() > > > > This is all kinds of wrong: > > > > http://3v4l.org/UZFME > > > > So the

RE: [PHP-DEV] vsprintf()

2013-04-24 Thread Richard Bradley
> -Original Message- > From: Rasmus Schultz [mailto:ras...@mindplay.dk] > Sent: 24 April 2013 16:45 > To: PHP internals > Subject: [PHP-DEV] vsprintf() > > This is all kinds of wrong: > > http://3v4l.org/UZFME > > So the order in which the properties were defined is the magic that makes >

Re: [PHP-DEV] vsprintf()

2013-04-24 Thread Johannes Schlüter
On Wed, 2013-04-24 at 11:45 -0400, Rasmus Schultz wrote: > This is all kinds of wrong: > > http://3v4l.org/UZFME > > So the order in which the properties were defined is the magic that makes > this work. > > Wow. WTF? > > Do I need to explain in detail why this is all kinds of effed up? vsprin

Re: [PHP-DEV] vsprintf()

2013-04-24 Thread Levi Morrison
On Wed, Apr 24, 2013 at 9:45 AM, Rasmus Schultz wrote: > > Do I need to explain in detail why this is all kinds of effed up? > > Yes, I'd like that explanation.