TypeError thrown

str_replace(): Argument #2 ($replace) must be of type string when argument #1 ($search) is a string