This also appears to be the function which gets used within the contains() function, so if all the objects you are storing already have a unique id you can overwrite this function with your own class.
<?php
class UserStorage extends SPLObjectStorage{
public function getHash($obj){
return $obj->id;
}
}
$us = new UserStorage();
$user1 = new User(1);
$user2 = new User(2);
$us->attach($user1);
$us->attach($user2);
$me = new User(2);
// the following would normally fail since they are two separate objects
// but it works now with our extended getHash()
$us->contains($me);
?>