note 107594 deleted from function.serialize by tularis

From: Date: Mon, 20 Feb 2012 21:05:14 +0000
Subject: note 107594 deleted from function.serialize by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-186242@lists.php.net to get a copy of this message
Note Submitter: lynch at php dot net ---- This one time, I had a Drupal database where we had changed the URLs/directories/paths out from under it. Of course, all images etc went missing. So we wanted to mysqldump the SQL and hand-edit the paths with global search and replace. Some of the data is stored serialized... Subtracting the difference between "before" and "after" for each string was quite tedious and error-prone, and I ended up bleary-eyed and making many mistakes. PHP was "smart enough" to forgive when I was a bit "short" in the :a: count, but going over was Bad News (tm). Thus, I wrote this quick hack of a shell script in PHP to "fix" any wrong strlen counts in the serialized data. NOTE: This *only* fixes 'string' data. I believe it could be easily extended for 'scalar' data types. And perhaps even 'complex' data types, though hand-editing those might prove challenging... BACKUP YOUR DATA FIRST NO PROMISE THIS WILL WORK FOR YOU Preview: http://6112northwolcott.com/serialized_string_fix.sh.txt Syntax-highlighted: http://6112northwolcott.com/serialized_string_fix.sh.phps Download: http://6112northwolcott.com/serialized_string_fix.sh BACKUP YOUR DATA FIRST NO PROMISE THIS WILL WORK FOR YOU

« previous php.notes (#186242) next »