Nothing spectacular, just ahead of the line with the error message I added a var_dump($before); to see that the content of the variable is an object instead of a string, then I checked the Codex to see the parameters of the function being called.