#40948 [NEW]: missing parameters for constructor produces E_WARNING - should be E_FATAL

From: Date: Thu, 29 Mar 2007 10:38:18 +0000
Subject: #40948 [NEW]: missing parameters for constructor produces E_WARNING - should be E_FATAL
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110919@lists.php.net to get a copy of this message
From: jestar342 at hotmail dot com Operating system: All PHP version: 5.2.1 PHP Bug Type: Class/Object related Bug description: missing parameters for constructor produces E_WARNING - should be E_FATAL 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 bug report at http://bugs.php.net/?id=40948&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40948&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40948&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40948&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40948&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40948&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40948&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40948&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40948&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40948&r=support Expected behavior: http://bugs.php.net/fix.php?id=40948&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40948&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40948&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40948&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40948&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40948&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40948&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40948&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40948&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40948&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40948&r=mysqlcfg

« previous php.bugs (#110919) next »