note 98321 deleted from function.unserialize by danbrown

From: Date: Thu, 09 Sep 2010 14:19:03 +0000
Subject: note 98321 deleted from function.unserialize by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172415@lists.php.net to get a copy of this message
Note Submitter: thor222 at gmail dot com ---- If you serialize date which includes a \n and then try to unserialize it will not work as a class. Using a modification of the __unserialize fucntion <?php function __unserialize($sObject) { $sObject = ereg_replace("\n", " ", $sObject); return preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $sObject ); } ?>

« previous php.notes (#172415) next »