note 93606 added to function.unserialize

From: Date: Fri, 18 Sep 2009 02:15:23 +0000
Subject: note 93606 added to function.unserialize
Groups: php.notes 
Request: Send a blank email to php-notes+get-160814@lists.php.net to get a copy of this message
The methods here for correcting string lengths in UTF-8 encoded serialized data weren't reliable for me; various of the data I had stored broke them. This is the method that handled all of my cases: $serialized = preg_replace_callback( '!(?<=^|;)s:(\d+)(?=:"(.*?)";(?:}|a:|s:|b:|i:|o:|N;))!s', 'serialize_fix_callback', $serialized ); function serialize_fix_callback($match) { return 's:' . strlen($match[2]); } ---- Server IP: 209.41.74.194 Probable Submitter: 76.98.125.126 ---- Manual Page -- http://www.php.net/manual/en/function.unserialize.php Edit -- https://master.php.net/note/edit/93606 Del: integrated -- https://master.php.net/note/delete/93606/integrated Del: useless -- https://master.php.net/note/delete/93606/useless Del: bad code -- https://master.php.net/note/delete/93606/bad+code Del: spam -- https://master.php.net/note/delete/93606/spam Del: non-english -- https://master.php.net/note/delete/93606/non-english Del: in docs -- https://master.php.net/note/delete/93606/in+docs Del: other reasons-- https://master.php.net/note/delete/93606 Reject -- https://master.php.net/note/reject/93606 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160814) next »