ZF-7042: metadata cache identifier collisions
Description
The cache identifier where the metadata are saved is not unique:
- schema is not mandatory, so if you have two databases with a same table name in both and you haven't set the schema it will generate the same id.
- you can connect to databases on different host or port and it's also not include in the id so there are collisions.
$cacheId = md5("$this->_schema.$this->_name");
should be replace to :
//get db configuration
$dbConfig = $this->_db->getConfig();
//get the port if available
$port = isset($dbConfig['options']['port']) ? ':'.$dbConfig['options']['port'] : null;
//get the custom schema or the default schema if not specified
$schema = !empty($this->_schema) ? $this->_schema : $dbConfig['dbname'];
// Define the cache identifier where the metadata are saved
$cacheId = md5($dbConfig['host'].$port.'/'.$schema.'.'.$this->_name);
Comments
Posted by Mickael Perraud (mikaelkael) on 2009-08-25T06:46:46.000+0000
Exactly the same for me today ;)
But with your correction, we can't have same schema in different database on same server.
I choose:
Posted by Ralph Schindler (ralph) on 2009-08-25T16:47:54.000+0000
Used patch supplied.
Fixed in trunk in 17819, and merged to release branch 1.9 in 17820