Bug #60161 [Opn->Csd]: Implementing an interface extending Traversable is order dependent
Edit report at https://bugs.php.net/bug.php?id=60161&edit=1
ID: 60161
Updated by: nikic@php.net
Reported by: nikic@php.net
Summary: Implementing an interface extending Traversable is
order dependent
-Status: Open
+Status: Closed
Type: Bug
Package: Scripting Engine problem
PHP Version: 5.4.0beta2
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Looks like this got fixed in 7.4. Test added in https://github.com/php/php-src/commit/8c8f8c419378822f336aab13f301519cf2b95feb.
Previous Comments:
------------------------------------------------------------------------
[2016-12-13 00:28:18] thecelavi at mac dot com
Fatal: https://3v4l.org/ogZk4
Fatal: https://3v4l.org/9VqNt
Fine: https://3v4l.org/JhECB
Expected: Every example should execute fine.
------------------------------------------------------------------------
[2014-03-27 01:31:51] levim@php.net
I don't care as much about the abstract issue (it's filed separately: https://bugs.php.net/bug.php?id=62609) but I'd
really like to see the order restriction be relaxed on interfaces.
------------------------------------------------------------------------
[2013-10-12 17:57:02] maciej dot sz at gmail dot com
The order dependency of interface names is a minor drawback, but same thing happens when one tries
to put an abstract class between the interface and specific implementation. And this is a big
problem:
<?php
interface IFoo extends \Traversable
{}
abstract class AFoo implements IFoo
{}
?>
Throws:
Class AFoo must implement interface Traversable as part of either Iterator or IteratorAggregate in
Unknown on line 0
------------------------------------------------------------------------
[2011-11-02 17:50:13] nikic@php.net
Yes, exactly. That's what I was trying to do when I encountered the issue.
------------------------------------------------------------------------
[2011-11-02 17:16:29] johannes@php.net
You mean for a type hint which says "traversable and having that function"? That might
indeed be a valid reason I didn't think about ..
------------------------------------------------------------------------
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=60161
--
Edit this bug report at https://bugs.php.net/bug.php?id=60161&edit=1
Thread (9 messages)