Only do str_replace if $file is actually a string.