#40948 [Opn->Bgs]: missing parameters for constructor produces E_WARNING - should be E_FATAL

From: Date: Thu, 29 Mar 2007 10:47:06 +0000
Subject: #40948 [Opn->Bgs]: missing parameters for constructor produces E_WARNING - should be E_FATAL
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110921@lists.php.net to get a copy of this message
ID: 40948 Updated by: tony2001@php.net Reported By: jestar342 at hotmail dot com -Status: Open +Status: Bogus -Bug Type: Class/Object related +Bug Type: Feature/Change Request Operating System: All PHP Version: 5.2.1 New Comment: This behaviour is consistent for all functions including constructors and we don't have any plans to change it. Previous Comments: ------------------------------------------------------------------------ [2007-03-29 10:38:17] jestar342 at hotmail dot com Description: ------------ Instantiating an object from a class with *required* parameters does not cease instantiation. In my humble opinion, as we have the ability to use optional parameters, missing required parameters should generate E_FATAL error. Reproduce code: --------------- class Foo { public function __construct ($bar) {} public function doSomething() {} } $foo = new Foo(); // E_WARNING $foo->doSomething(); // this will still execute. Expected result: ---------------- class Foo { public function __construct ($bar) {} public function doSomething() {} } $foo = new Foo(); // E_FATAL $foo->doSomething(); // this will not execute. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40948&edit=1

« previous php.bugs (#110921) next »