|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67782 Internal Cursors
Submitted: 2014-08-05 17:11 UTC Modified: 2015-06-30 17:02 UTC
From: Assigned:
Status: Open Package: PHP Language Specification
PHP Version: PHP-5.6 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2014-08-05 17:11 UTC]

 The concept of an array's internal cursor or an object's internal cursor is never mentioned. The state of the internal cursor of an array or object can be witnessed via the current(), key(), next(), prev(), reset(), end(), and each() library functions. While it's technically library functions that expose the state of the cursor to the programmer, you can find code deep in the core array/object implementation of PHP5 that deals with and maintains internal cursors. Also, internal cursors get mentioned in various parts of the documentation, including the documentation for "foreach", so internal cursors are arguably a language feature. 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-28 21:55 UTC]
-PHP Version: Irrelevant +PHP Version: PHP-5.6
 [2015-06-28 21:55 UTC]
I'm not sure this has a place in the spec, as this is largely an implementation detail, also one that changes somewhat between 5.6 and 7.
 [2015-06-30 17:02 UTC]
In case this does get documented: one weird case is that these also work with some container objects, but not subclasses of them - eg if you override offsetGet in an ArrayObject subclass, you get different results with cur/next/prev vs other forms of iteration.

For what it's worth, HHVM hasn't implemented these for objects and we've had very few compatibility issues reported because of this; almost all of the reports actually turned out to be buggy PHP code because of the subtleties of it.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Sep 22 18:01:24 2023 UTC