Fixing str_replace optimizer with array search parameter