#44793 [Bgs->Opn]: ArrayObject does not report as Iterator
| From: | weierophinney@php.net | Date: | Mon, 21 Apr 2008 16:07:35 +0000 |
| Subject: | #44793 [Bgs->Opn]: ArrayObject does not report as Iterator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124409@lists.php.net to get a copy of this message | ||
ID: 44793
Updated by: weierophinney@php.net
Reported By: matthew at zend dot com
-Status: Bogus
+Status: Open
Bug Type: SPL related
Operating System: Linux (Ubuntu)
PHP Version: 5.2.5
New Comment:
Re-opening
Previous Comments:
------------------------------------------------------------------------
[2008-04-21 16:03:38] matthew at zend dot com
This is a bug in SPL, which is bundled in PHP core; additionally, it
exposes a potential issue with how inheritence is resolved in the
language. Please re-open.
------------------------------------------------------------------------
[2008-04-21 15:51:24] colder@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
class ArrayObject implements IteratorAggregate, Traversable,
ArrayAccess, Serializable, Countable.
Traversable is not the same as Iterator: Traversable allows an object
to be magically iterated by, i.e foreach, while Iterator explicitly
provides userland iteration interface through
next/valid/current/key/rewind.
------------------------------------------------------------------------
[2008-04-21 12:52:27] matthew at zend dot com
Description:
------------
ArrayObject extends ArrayAccess, which implements ArrayIterator and in
turn Iterator. However, when checking to see if a concrete instance of
ArrayObject implements Iterator, the return is false.
Reproduce code:
---------------
$o = new ArrayObject(array());
if ($o instanceof Iterator) {
echo "Instance of Iterator";
} else {
echo "Failed";
}
Expected result:
----------------
Instance of Iterator
Actual result:
--------------
Failed
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44793&edit=1