Fixed inefficient use of array_keys() introduced by Nick in r17880. If this is settin...