Just looked I'm on 2.4.19
I'm a complete noob at this but if I understand it right I just add
$search_string_array = array();
to line 118? and move the rest of the code down
I don't understand your mention of line 52. The code in that area doesn't look like what you posted.