#34019 [NEW]: Implementing interface with a __construct method strange behaviour

From: Date: Sat, 06 Aug 2005 12:09:10 +0000
Subject: #34019 [NEW]: Implementing interface with a __construct method strange behaviour
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-83090@lists.php.net to get a copy of this message
From:             stochnagara at hotmail dot com
Operating system: windows xp
PHP version:      5.0.4
PHP Bug Type:     Class/Object related
Bug description:  Implementing interface with a __construct method strange behaviour

Description:
------------
When a class implements an interface which declares a funciton __construct
with a given prototype and the class does not follow this prototype, then
PHP does not raise a fatal error like in all other cases.

I know that __construct has a lot of special features but I think we need
at least a notice for that.

Reproduce code:
---------------
interface constr {
	function __construct();
}

class implem implements constr {
	function __construct ($a) {
	}
}


Expected result:
----------------
Fatal error:  Declaration of implem::__construct() must be compatible with
that of constr::__construct() in ...

Actual result:
--------------
5

-- 
Edit bug report at http://bugs.php.net/?id=34019&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34019&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34019&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34019&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34019&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34019&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34019&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34019&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34019&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34019&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34019&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=34019&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=34019&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34019&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34019&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34019&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34019&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34019&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34019&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34019&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34019&r=mysqlcfg


Thread (7 messages)

« previous php.bugs (#83090) next »