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

Issue Type: Bug Created: 2008-12-18T01:28:52.000+0000 Last Updated: 2008-12-18T02:29:50.000+0000 Status: Resolved Fix version(s): Reporter: Roman Schmid (banal) Assignee: Thomas Weidner (thomas) Tags: - Zend_File_Transfer

Related issues: - ZF-5187



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'); }


Posted by Thomas Weidner (thomas) on 2008-12-18T02:29:22.000+0000

Duplication of existing and already solved issue

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.