|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57205 Request for additional SplObjectStorage methods.
Submitted: 2006-08-30 11:53 UTC Modified: 2014-03-28 19:48 UTC
From: wb at pro-net dot co dot uk Assigned: helly (profile)
Status: Closed Package: SPL related
PHP Version: 5.* OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: wb at pro-net dot co dot uk
New email:
PHP Version: OS:


 [2006-08-30 11:53 UTC] wb at pro-net dot co dot uk
I would just like to propose the addition of the following methods to the SplObjectStorage class. These methods allow you to specify the object attachment position and will therefore affect the order the objects are returned when iterating over the SplObjectStorage object.

 * Attach an object before an existing object.
 * If $new is already attached then it position is moved.
 * If $ref is not attached an exception is thrown.
public function attachBefore($new, $ref);

 * Attach an object after an existing object.
 * Works as attachBefore().
public function attachAfter($new, $ref);

 * Attach an object to the front.
public function attachFirst($obj);

Reproduce code:

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-31 21:34 UTC]
Right now this is impossible as we store them by hash codes. I need to think about it.
 [2006-09-01 05:38 UTC] wb at pro-net dot co dot uk
Thanks for taking the time to consider the request.

I eagerly await your decision :)
 [2014-03-27 15:21 UTC]
-Package: SPL +Package: SPL related
 [2014-03-28 19:48 UTC]
-Status: Assigned +Status: Closed
 [2014-03-28 19:48 UTC]
Closing. This is infeasible to do given the current implementation and a new implementation would likely cause backwards compatibility breaks.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Jan 23 14:03:42 2022 UTC