Skip to content

Instantly share code, notes, and snippets.

@ramonornela
Created August 6, 2011 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramonornela/1129015 to your computer and use it in GitHub Desktop.
Save ramonornela/1129015 to your computer and use it in GitHub Desktop.
reproduce issue
<?php
//@see ZF-10543
set_include_path('/your_path');
define("DIR_CACHE", "./temp/cache"); // change to your dir cache
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
$application = new Zend_Application('testing', './zf-11636.ini');
$application->getBootstrap()
->setContainer(Zend_Registry::getInstance())
->bootstrap();
_setupTable();
_asserts();
function _setupTable()
{
global $db1, $db2;
$sql = 'CREATE TABLE zf11636(issue integer PRIMARY KEY);';
$multiDB = Zend_Registry::get('multidb');
$db1 = $multiDB->getDb('db1');
$db2 = $multiDB->getDb('db2');
_dropTable();
$db1->query($sql);
$db2->query($sql);
}
function _asserts()
{
global $db1, $db2;
$cacheManager = Zend_Registry::get('cachemanager');
$cache = $cacheManager->getCache('database');
$tableDb1 = new Zend_Db_Table(array('db' => $db1, 'name' => 'zf11636'));
$tableDb2 = new Zend_Db_Table(array('db' => $db2, 'name' => 'zf11636'));
// caching metadata
$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
$tableDb1->info(Zend_Db_Table::COLS);
$tableDb2->info(Zend_Db_Table::COLS);
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 1);
assert(Zend_Db_Table::getDefaultMetadataCache() == $cache);
assert(4 == iterator_count(new RecursiveDirectoryIterator(DIR_CACHE)));
$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
_dropTable();
}
function _dropTable()
{
global $db1, $db2;
try {
$db1->query('DROP TABLE zf11636');
} catch (Exception $e) {
}
try {
$db2->query('DROP TABLE zf11636');
} catch (Exception $e) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment