Re: [RFC] Default constructors

From: Date: Tue, 18 Nov 2014 22:56:41 +0000
Subject: Re: [RFC] Default constructors
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-78964@lists.php.net to get a copy of this message
On 18/11/2014 21:53, Andrea Faulds wrote:
On 18 Nov 2014, at 21:51, Rowan Collins <rowan.collins@gmail.com> wrote: Personally, I would much prefer the backwards compatibility break to happen. It is frankly quite bizarre, and not at all useful, that the following two pieces of code behave differently: class Foo {} new Foo( print('hello') ); // silent vs class Foo { function __construct() {} } new Foo( print('hello') ); // says "hello" (Incidentally, HHVM doesn't have this "optimisation", and says "hello" in both cases: http://3v4l.org/ZDXs1) If I came upon this without knowing more, I would assume it was a bug in PHP, and any code relying on it was in need of fixing ASAP.
In fact, it *is* a bug: https://bugs.php.net/bug.php?id=67829
Or, depending on who looks at the report, it's Not A Bug: https://bugs.php.net/bug.php?id=54162 But, yes, I would argue that both reports are actually valid, and this behaviour, however long-standing, is an accident of implementation, not a design decision that anyone can actually justfiy. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#78964) next »