Don't you mean !empty($keySizes) ? The condition below never gets executed otherwhise. Maybe you could check if $keySizes is empty and if it is, `$keySizes = range(1, mcrypt_module_get_algo_key_size());`