In the default.settings.php,it says
* To have all database names prefixed, set $db_prefix as a string:
*
* $db_prefix = 'main_';
*
* To provide prefixes for specific tables, set $db_prefix as an array.
* The array's keys are the table names and the values are the prefixes.
* The 'default' element holds the prefix for any tables not specified
* elsewhere in the array. Example:
*
* $db_prefix = array(
* 'default' => 'main_',
* 'users' => 'shared_',
* 'sessions' => 'shared_',
* 'role' => 'shared_',
* 'authmap' => 'shared_',
* );
And then,in includes/common.inc on line 486,the following code may cause a problem
// If the database prefix is being used by SimpleTest to run the tests in a copied
// database then set the user-agent header to the database prefix so that any
// calls to other Drupal pages will run the SimpleTest prefixed database. The
// user-agent is used to ensure that multiple testing sessions running at the
// same time won't interfere with each other as they would if the database
// prefix were stored statically in a file or database variable.
if (preg_match("/simpletest\d+/", $GLOBALS['db_prefix'], $matches)) {
$defaults['User-Agent'] = 'User-Agent: ' . $matches[0];
}
If I use an array defenition of the $db_prefix,it may cause an php waring as following every time i run cron.
warning: preg_match() expects parameter 2 to be string, array given in /srv/http/drupal/includes/common.inc on line 492.
I add a check whether the $db_prefix to avoid this warning,but i think this shoud have a better solution.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | common - Kopie.inc_fix.diff | 609 bytes | em_mah |
Comments
Comment #1
bs commentedany fix? We face similar problem in multi-site setup. some times it seems to be working and some times won't.
Comment #2
bs commentedthis is my fix for custom function:
Comment #3
em_mah commentedHi,
the most simplest fix would be to check, whether $GLOBALS['db_prefix'] is a string. Since testing should normally not require to split tableprefixes, this seems accurat to me.