Zend_Db_Table_Abstract

2 messages Options
Embed this post
Permalink
Matthias Buesing

Zend_Db_Table_Abstract

Reply Threaded More More options
Print post
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,
in Zend_Db_Table_Abstract.php there is a function
"protected function _setupMetadata()" in which this line appears:

$cacheId = md5("$this->_schema.$this->_name");

My questions are:
What is the reason to md5 the cacheId?
Isn't it potentially dangerous to build the cache-ID this way?
What about the risk of md5-collisions if other modules build
their cache-IDs like this, too?

Regards
Matthias Buesing,Germany
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkn8iJsACgkQu+8ZgkpYwRskvgCfa5D7QAIHsY3bMKkxq2d2RVGR
BywAoIz7Ukq9xNcK2MeP30+JQgo86GaD
=oiJ1
-----END PGP SIGNATURE-----
weierophinney

Re: Zend_Db_Table_Abstract

Reply Threaded More More options
Print post
Permalink
-- Matthias Buesing, mediaraum <[hidden email]> wrote
(on Saturday, 02 May 2009, 07:53 PM +0200):

> in Zend_Db_Table_Abstract.php there is a function
> "protected function _setupMetadata()" in which this line appears:
>
> $cacheId = md5("$this->_schema.$this->_name");
>
> My questions are:
> What is the reason to md5 the cacheId?
> Isn't it potentially dangerous to build the cache-ID this way?
> What about the risk of md5-collisions if other modules build
> their cache-IDs like this, too?

First off, MD5 collisions are really, really rare, so that's not much of
a worry.

The reason that md5 is used to create the cacheId is because Zend_Cache
is very restrictive in what it allows for cache identifiers; providing
an md5sum is a way to ensure the identifier will be correctly formatted
for use with it.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/