note 117328 added to class.splobjectstorage

From: Date: Fri, 22 May 2015 07:41:49 +0000
Subject: note 117328 added to class.splobjectstorage
Groups: php.notes 
Request: Send a blank email to php-notes+get-202638@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: 2a02:a03f:18d6:fa00:59e2:2f44:7a2a:48be ---- Manual Page -- http://php.net/manual/en/class.splobjectstorage.php Edit -- https://master.php.net/note/edit/117328 Del: integrated -- https://master.php.net/note/delete/117328/integrated Del: useless -- https://master.php.net/note/delete/117328/useless Del: bad code -- https://master.php.net/note/delete/117328/bad+code Del: spam -- https://master.php.net/note/delete/117328/spam Del: non-english -- https://master.php.net/note/delete/117328/non-english Del: in docs -- https://master.php.net/note/delete/117328/in+docs Del: other reasons-- https://master.php.net/note/delete/117328 Reject -- https://master.php.net/note/reject/117328 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202638) next »