php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63554 Is SplObjectStorage ordered?
Submitted: 2012-11-18 20:19 UTC Modified: 2013-01-14 14:49 UTC
From: francois dot gannaz at silecs dot info Assigned:
Status: Not a bug Package: SPL related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2012-11-18 20:19 UTC] francois dot gannaz at silecs dot info
Description:
------------
The documentation describes SplObjectStorage as "a map from objects to data". Is this map ordered or not? As it seems to be ordered, at least with the PHP version I tested with, can we rely on this undocumented feature for future releases and different OS? Please detail this main characteristic.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-12 05:00 UTC] frozenfire@php.net
-Status: Open +Status: Not a bug
 [2013-01-12 05:00 UTC] frozenfire@php.net
SplObjectStorage is implemented using an array as its internal storage mechanism, 
so one could consider it ordered. However, its purpose is more for to provide a 
mechanism whereby an object exist in the set or not, with no concerns for 
duplication in the set.

I do not believe that the order of the set is relevant to its purpose. Its order 
in the set is determined entirely by the order in which the objects were 
attached. This is incidental, rather than intentional.
 [2013-01-14 14:49 UTC] francois dot gannaz at silecs dot info
Thank you for your comment. Would it be possible to add this explanation to the documentation? Even one short sentence would be make it clearer that the map may not be iterable by insertion order.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 11:01:31 2024 UTC