If you simply perform a search and replace in this way, you will not transmit serialized data. Here is what you need to do:
$old = 'http://www.google.com'; $new = 'http://www.someplace.com'; $search = 's:' . strlen($old) .':"' . $old . '"'; $replace = 's:' . strlen($new) .':"' . $new . '"'; $query = "UPDATE config SET array=REPLACE(array, '{$search}', '{$replace}');";
Replace $old and $new your current and destination URL, run the script, and execute the generated $query .
Here's a clean SQL solution:
SET @search := 'http://www.original.com'; SET @replace := 'http://www.target.com'; UPDATE config SET array=REPLACE(array, CONCAT('s:', LENGTH(@search), ':"', @search, '"'), CONCAT('s:', LENGTH(@replace), ':"', @replace, '"'));
Note that this will replace EVERY appearance of the search string in your serialized array. If you want to replace a specific key, you need to be more specific.
source share