Backport fix GH-17280: ldap_search() fails when $attributes array has holes Backport of GH-17284 to fix GH-17280 on lower branches. Closes GH-17287.