Edit report at http://bugs.php.net/bug.php?id=54170&edit=1
ID: 54170 Comment by: info at liefcoden dot nl Reported by: martijn at site-to-make dot nl Summary: Object instantion argument not executed when the constructor is missing Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: Debian 6.0 PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: Well then, let me tell my customers their applications might break down because of this "feature". Thanks very much. Previous Comments: ------------------------------------------------------------------------ [2011-03-05 19:41:41] ras...@php.net Without a constructor the arguments to the new call mean nothing and are optimized away. The object is still created: class A { } $b = new A(new ThisIsANotExistingClass()); var_dump($b); outputs: object(A)#1 (0) { } ------------------------------------------------------------------------ [2011-03-05 19:33:32] info at liefcoden dot nl As an addition (because it is probably the same problem): class B { public function __construct( ) { echo 'B::__construct();'; } } class A { } new A( new B( ) ); The above code prints nothing as well. ------------------------------------------------------------------------ [2011-03-05 19:21:04] martijn at site-to-make dot nl Description: ------------ I runned in a very weird issue. When i create a new object, with another object instantation as argument, the 2nd object is not created if the first class has no constructor. It looks the arguments are simply not executed when the constructor is missing. When a constructor is added, it works like it should. I tested this with multiple 5.3 versions and its confirmed as not working by multiple people. Test script: --------------- <?php class A {} new A(new ThisIsANotExistingClass()); Expected result: ---------------- A nice fatal error since ThisIsANotExistingClass is missing. Actual result: -------------- The scripts runs fine and nothing apears on the screen. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54170&edit=1