Table query error
dennys - October 17, 2007 - 00:03
| Project: | Database Administration |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
When I upgraded to 2007-10-16 version, I got the message in table query. This function is ok in previous version. My Drupal is 5.2
warning: array_merge() [function.array-merge]: Argument #1 is not an array in /www/includes/menu.inc on line 415.
warning: Missing argument 1 for drupal_get_form() in /www/includes/form.inc on line 48.
warning: Missing argument 1 for drupal_retrieve_form() in /www/includes/form.inc on line 178.
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '' was given in /www/includes/form.inc on line 217. 
#1
At line 85 I added the $table = $tables[0] to make it work again:
elseif (strstr(drupal_get_path_alias($_GET['q']), 'admin/build/database')) {
$tables = dba_get_active_tables(0);
if (!empty($tables) && count($tables) == 1) {
// You can only view or describe one table at a time.
$table = $tables[0]; <----------- ADD THIS
// Regular subtabs.
#2
Thanks, it works again now.
#3
I had this exact problem, and the solution worked.
#4
Thanks for the report and the proposed fix. However, that's not really a patch. Please see http://drupal.org/patch and attach an actual patch. Makes it much easier to review and apply the changes to the code. Thanks!
#5
Making an official patch is beyond my very limited skills ;)
I hope bago or someone else will do so ...
#6
Here is the patch for bago's code. Please help to review it, thanks. I use this command to generate the patch
diff -up dba.module.old dba.module > dba.diff#7
Thank for the patch. Upon closer inspection:
A) Your patch had a bunch of whitespace after the ; in the line you added.
B) I think
$table = reset($tables)is generally safer, since that will always return the first element in the array, even if the numeric indexes don't start from 0 for some reason.C) A little CVS archeology shows that this was broken by my patch for HEAD over at http://drupal.org/node/154227#comment-264226 (comment #2). I simply left out this important line of code (which is already in the version in DRUPAL-4-7) from the patch I had rolled for HEAD. Whoops. ;)
Anyway, I committed the fix using reset() to HEAD (so that DRUPAL-4-7 and HEAD are in sync again regarding this code) and all those menu items are now working in my 5.x test site.
Sorry about the bug, and thanks for the report and first try at a fix! I didn't list y'all in the CVS commit since I didn't use your code, but I totally appreciate you taking the time to find the problem and supply a patch. Hopefully the next time I'll just be able to use your patch directly and be able to put "#XXXXX by bago and dannys: Fixed ..." in the CVS log. ;)
Cheers,
-Derek
#8
#9
Automatically closed -- issue fixed for two weeks with no activity.