Bug #63816 [NoF->Opn]: implementation child interface and after parent cause fatal error.

From: Date: Thu, 14 Jan 2016 13:10:54 +0000
Subject: Bug #63816 [NoF->Opn]: implementation child interface and after parent cause fatal error.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198646@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63816&edit=1

 ID:                 63816
 Updated by:         danack@php.net
 Reported by:        kotlyar dot maksim at gmail dot com
 Summary:            implementation child interface and after parent
                     cause fatal error.
-Status:             No Feedback
+Status:             Open
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   linux
 PHP Version:        5.4.7
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

Dmitry wrote:
"it's not a big deal to fix a script once you see this FATAL error." 

Why should people have to fix their script. There is nothing wrong with their code, PHP is just
being a bit dumb.

"so the following buggy code becomes legal.

<?php
interface foo {}
class bar implements foo, foo {}
?>

"

I don't see the problem. All that implementing an interface does is say that a class must
implement certain methods with particular signatures. Although implementing an interface multiple
times doesn't add anything, I can't see the problem for the simple case, 


But for more complex cases where someone has multiple classes that implement various interfaces,
including the "\Serializable" interface. They then realise that one of the user-defined
interfaces should actually extend "\Serializable".

Doing that, would make some code break, depending on what order the implements interfaces was
written as.

That's a real problem that imo people shouldn't have to 'fix their scripts' for.


Previous Comments:
------------------------------------------------------------------------
[2013-02-18 00:36:10] php-bugs at lists dot php dot net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

------------------------------------------------------------------------
[2013-01-11 12:03:19] kotlyar dot maksim at gmail dot com

I think that described order of interfaces is absolutely correct. So there 
should not be a warning\fatal.

About BC break. I dont feel like expert in this question. Personally I dont 
think that this BC break would be a problem because:

1) There are few developers how can implement interfaces in this order. 
2) They will be affected only while downgrade of php version.
3) The fatal error message gives some usefull info about what could be a 
problem.
4) The change log of php 5.5 would contain description of this change.

------------------------------------------------------------------------
[2013-01-10 06:20:47] dmitry@php.net

It may be a warning, but actually it's not a big deal to fix a script once you see this FATAL
error.
Finally, if we change it to warning, some script will work on 5.5 but fail on 5.3. Do we really need
to introduce another incompatibility because of this small issue?

------------------------------------------------------------------------
[2013-01-10 04:40:07] laruence@php.net

Hey, I think it not deserved a FATAL.  maybe a warning ?

------------------------------------------------------------------------
[2013-01-09 10:49:51] kotlyar dot maksim at gmail dot com

@dmitry I see you reason. I am completely agree with you that be silent and allow 
two same interface is not a good solution.

But from the other side. I believed that I could implement interface in any order 
I want. Ordering of interfaces(maybe should be?) is not documented anywhere.
Also the described situation could be resolved without a fatal error so it at 
least not developer friendly.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=63816


--
Edit this bug report at https://bugs.php.net/bug.php?id=63816&edit=1


Thread (13 messages)

« previous php.bugs (#198646) next »