Fresh install / upgrade causes error common.inc on line 492 with shared tables
porkiey - July 3, 2009 - 00:37
| Project: | Drupal |
| Version: | 6.13 |
| Component: | base system |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | duplicate |
Description
I have made only one configuration change which was the following
$db_url = 'mysqli://username:password@mysqlserver/databasename';
$db_prefix = array(
'default' => 'default_',
'authmap' => 'drupal_shared_',
'profile_fields' => 'drupal_shared_',
'profile_values' => 'drupal_shared_',
'role' => 'drupal_shared_',
'sessions' => 'drupal_shared_',
'users' => 'drupal_shared_',
'users_roles' => 'drupal_shared_',
);But this then shows the following errors in the admin area:
* warning: preg_match() expects parameter 2 to be string, array given in /mnt/stor1-wc1-dfw1/376823/www.hackedmedia.com/web/content/includes/common.inc on line 492.
* warning: preg_match() expects parameter 2 to be string, array given in /mnt/stor1-wc1-dfw1/376823/www.hackedmedia.com/web/content/includes/common.inc on line 492.and the php logs show
[02-Jul-2009 10:08:45] PHP Warning: Table 'databasename.default_access' doesn't exist
query: SELECT 1 FROM default_access WHERE type = 'host' AND LOWER('58.37.192.137') LIKE LOWER(mask) AND status = 0 LIMIT 0, 1 in /mnt/stor1-wc1-dfw1/376823/www.hackedmedia.com/web/content/includes/database.mysqli.inc on line 128
[02-Jul-2009 10:08:45] PHP Warning: Table 'databasename.drupal_shared_users' doesn't exist
query: SELECT u.*, s.* FROM drupal_shared_users u INNER JOIN drupal_shared_sessions s ON u.uid = s.uid WHERE s.sid = '6171p3hgv876j7kbcelhik9ut5' in /mnt/stor1-wc1-dfw1/376823/www.hackedmedia.com/web/content/includes/database.mysqli.inc on line 128
[02-Jul-2009 10:08:45] PHP Warning: Table 'databasename.default_cache' doesn't exist
query: SELECT data, created, headers, expire, serialized FROM default_cache WHERE cid = 'variables' in /mnt/stor1-wc1-dfw1/376823/www.hackedmedia.com/web/content/includes/database.mysqli.inc on line 128
[02-Jul-2009 10:08:45] PHP Warning: Table 'databasename.default_variable' doesn't exist
query: SELECT * FROM default_variable in /mnt/stor1-wc1-dfw1/376823/www.hackedmedia.com/web/content/includes/database.mysqli.inc on line 128
[02-Jul-2009 10:08:45] PHP Warning: Table 'databasename.default_cache' doesn't exist
query: UPDATE default_cache SET data = '', created = 1246547325, expire = 0, headers = '', serialized = 0 WHERE cid = 'variables' in /mnt/stor1-wc1-dfw1/376823/www.hackedmedia.com/web/content/includes/database.mysqli.inc on line 128
[02-Jul-2009 10:08:45] PHP Warning: Table 'databasename.default_system' doesn't exist
query: SELECT name, filename, throttle FROM default_system WHERE type = 'module' AND status = 1 AND bootstrap = 1 ORDER BY weight ASC, filename ASC in /mnt/stor1-wc1-dfw1/376823/www.hackedmedia.com/web/content/includes/database.mysqli.inc on line 128
[02-Jul-2009 10:08:45] PHP Warning: Table 'databasename.default_url_alias' doesn't exist
query: SELECT COUNT(pid) FROM default_url_alias in /mnt/stor1-wc1-dfw1/376823/www.hackedmedia.com/web/content/includes/database.mysqli.inc on line 128Can anyone shed any light?
Thanks
Sam

#1
Interesting, Ive got the same error all over the place as well since I upgraded to 6.13.
Ive got an install which serves 7 websites with the same shared tables as you. Luckily the error is not causing any major problems so far, aside from annoyance, but it does seem to return with every module install.
So far I havent caught it do any real damage, but I do think this should be fixed soon before it will.
Upping it to priority critical.
Altered title slightly to represent full problem
#2
I have several sites on the same 6.13 installation and only two of them (which share core tables in the same database) give me that error. Fortunately (but still annoyingly) they're my personal sites, and not clients' sites.
#3
Same here.
#4
Duplicate of #482646: Backport SimpleTest testing in drupal_http_request().
#5
I have the same problem on a fresh multisite install with shared user tables.
#6
I can confirm using 6.13
#7
Same here, using 6.13
I've created a main site with site1_ and shared_ tables all ok for it
Then added another site with site2_ and shared_ tables and during install.php he told me that shared_ tables already exists and instalaltion stop. To finish install I'd to install with site2_ only tables then change the users tables to settings.php to shared_ and delete the same table with site2_ prefix.
Now all works but first time I logged in as admin I got in both sites the errors
* warning: preg_match() expects parameter 2 to be string, array given...
* warning: preg_match() expects parameter 2 to be string, array given...
#8
Here's the comment directly before the code causing the warning:
// 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.
However, there doesn't appear to be any code that actually reads the User-Agent header. I even installed SimpleTest and I'm not see where the two meet. Shouldn't the be a check to see if SimpleTest is even enabled or is this function called too early in the bootstrap process to do that?
I don't know the SimpleTest module all that well but I've attached a patch that merely checks that $GLOBALS['db_prefix'] isn't an array before proceeding.
#9
This bugreport is closed. The patches on http://drupal.org/node/482646#comment-1773522 have been already committed to head and the 6.x development version (will become Drupal 6.14).