Prevent execution of ticket searches in the database if a timestamp is invalid.
This fixes bug #9512.