note 103793 deleted from function.unserialize by thiago

From: Date: Wed, 04 May 2011 03:43:01 +0000
Subject: note 103793 deleted from function.unserialize by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179397@lists.php.net to get a copy of this message
Note Submitter: w33ble ---- The code chaos submitted mostly worked but broke when storing floating point numbers. The following change fixed it for me: $serialized = preg_replace_callback( '!(?<=^|;)s:(\d+)(?=:"(.*?)";(?:}|a:|s:|b:|d:|i:|o:|N;))!s', 'serialize_fix_callback', $serialized ); function serialize_fix_callback($match) { return 's:' . strlen($match[2]); } Just added d: to the regex, as that's the index used for floating point (digits)

« previous php.notes (#179397) next »