#27623 [Bgs]: implementation of interfaces not correct handled

From: Date: Wed, 17 Mar 2004 18:13:25 +0000
Subject: #27623 [Bgs]: implementation of interfaces not correct handled
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-56595@lists.php.net to get a copy of this message
ID: 27623 Updated by: helly@php.net Reported By: fd@php.net Status: Bogus Bug Type: Class/Object related Operating System: debian linux PHP Version: 5CVS-2004-03-17 (dev) New Comment: Maybe it is but PHP is still a weak typed language and other people make good use of that fact. They have E_STRICT off because turning it on makes PHP a bit more type strict. Previous Comments: ------------------------------------------------------------------------ [2004-03-17 07:56:24] fd@php.net That does not make sence in my eys. As an example, if you have a interface "car" which declares "four wheels" and an implementation of "car" just declares "three wheels" the car shouldn't even start driving. But now it does, I think that is stupid. ------------------------------------------------------------------------ [2004-03-17 06:27:08] derick@php.net No, we had a discussion on this on the internals@ list. This only throws an E_STRICT type error. ------------------------------------------------------------------------ [2004-03-17 06:04:07] fd@php.net Actually I do not get the point why that does not throw a fatal error, in my opinion the script should terminate on such an error, shouldn't it? ------------------------------------------------------------------------ [2004-03-17 05:53:24] derick@php.net This is correct behavior now, turn on E_STRICT and E_ALL and you'll see it. ------------------------------------------------------------------------ [2004-03-17 05:46:43] fd@php.net Description: ------------ A implementation of a class whith a method which is not declared as in the interface should throw an error, which it does in php5b4 but not in the current HEAD. Reproduce code: --------------- <?php interface Person { function doSth($sWhat,$sWhere); } class Member implements Person { function doSth($sWhat) { echo "Person does ".$sWhat."\n"; } } $Member = new Member; $Member->doSth('nothing'); ?> Expected result: ---------------- Fatal error: Declaration of Member::doSth() must be the same as Person::doSth() Actual result: -------------- Person does nothing ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27623&edit=1

« previous php.bugs (#56595) next »