|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
32 - 15 = ?
Subscribe to this entry?

 [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: Mon Jan 17 20:03:35 2022 UTC