For anyone having issues with SplObjectStorages containing corrupt member variables after garbage collection (FatalErrorException after serializing): we used following fix to great effect
<?php
class FixedSplObjectStorage extends SplObjectStorage
{
public function serialize()
{
$goodPortion = 'N;;m:a:0:{}';
$startKey = 'N;;m:a:';
$serialized = parent::serialize();
$startPos = strpos($serialized, $startKey);
if ($startPos !== false) {
$serialized = substr_replace($serialized, $goodPortion, $startPos, -1);
}
return $serialized;
}
}
?>