Check that search value is scalar before parsing.
Prevents PHP notices when non-scalar values are passed.
Includes unit tests.
Props tivnet. Fixes #29736.