Add additional guard from preventing an strpos with an empty preg match, fixes #1955