note 84730 modified in function.unserialize by felipe

From: Date: Mon, 28 Jul 2008 22:35:04 +0000
Subject: note 84730 modified in function.unserialize by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142877@lists.php.net to get a copy of this message
@ Igor for single quote trouble: <?php function mb_unserialize($serial_str) { $out = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str ); return unserialize($out); } ?> Unserialize with utf8 content get trouble and the code provided by the guy works fine. Code isn't mine: thanks to http://www.lastfm.pl/user/TheMariner --was-- @ Igor for single quote trouble: function mb_unserialize($serial_str) { $out = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str ); return unserialize($out); } Unserialize with utf8 content get trouble and the code provided by the guy works fine. Code isn't mine: thanks to http://www.lastfm.pl/user/TheMariner http://php.net/manual/en/function.unserialize.php

« previous php.notes (#142877) next »