note 117329 added to class.splobjectstorage
| From: | kris dot lamote at it-kitchen dot be | Date: | Fri, 22 May 2015 07:45:26 +0000 |
| Subject: | note 117329 added to class.splobjectstorage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202639@lists.php.net to get a copy of this message | ||
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;
}
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 80.200.116.78
----
Manual Page -- http://php.net/manual/en/class.splobjectstorage.php
Edit -- https://master.php.net/note/edit/117329
Del: integrated -- https://master.php.net/note/delete/117329/integrated
Del: useless -- https://master.php.net/note/delete/117329/useless
Del: bad code -- https://master.php.net/note/delete/117329/bad+code
Del: spam -- https://master.php.net/note/delete/117329/spam
Del: non-english -- https://master.php.net/note/delete/117329/non-english
Del: in docs -- https://master.php.net/note/delete/117329/in+docs
Del: other reasons-- https://master.php.net/note/delete/117329
Reject -- https://master.php.net/note/reject/117329
Search -- https://master.php.net/manage/user-notes.php