Issues

ZF-5303: Zend_File_Transfer_Adapter_Abstract doesn't determine hashing capabilities correctly

Description

The Zend_File_Transfer_Adapter_Abstract throws an Exception whenever the getHash Method is being called. This is because the hashing capabilities aren't correctly determined. The array that is returned by hash_algos is indexed and not an associative array. Therefore in_array should be used rather than the check for a certain key.

Affected Line in code: 1056

Edit: Here's a patch to fix the issue

--- Zend/File/Transfer/Adapter/Abstract.php +++ Zend/File/Transfer/Adapter/Abstract.php @@ -1053,7 +1053,7 @@ public function getHash($hash = 'crc32', $files = null) { $algorithms = hash_algos(); - if (!isset($algorithms[$hash])) { + if (!in_array($hash, $algorithms)) { require_once 'Zend/File/Transfer/Exception.php'; throw new Zend_File_Transfer_Exception('Unknown hash algorithm'); }

Comments

Duplication of existing and already solved issue