I want to replace all instances of a particular string in an object which includes properties, values and keys that include this string, including within longer keys/values that contain this string amongst other information.
Currently I'm doing this:
$amended_object = str_replace('search', 'replace', serialize($object));
$object = unserialize($amended_object);
So I turn the object into a string, search and replace, and convert it back.
However I often get Notice: unserialize(): Error at offset
when the object is in a particular state, and it seems like it's not a very good solution.