[1.5.x] Fixed #20237 (again) Allowed binary parameter to assertContains

Backport of b04fd579d5 from master.