Keyboard Shortcut Fatal error: Unsupported operand types in etc\includes\common.inc on line 1445

rCharles - November 10, 2008 - 20:11
Project:Keyboard shortcut utility
Version:6.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

This error shows for Drupal 6.5 & 6.6 when attempting to access admin/settings/shortcut.

// $Id: common.inc,v 1.756.2.29 2008/10/22 19:26:01 goba Exp $
1447  // Append active class.
1448  if ($path == $_GET['q'] || ($path == '<front>' && drupal_is_front_page())) {
1449    if (isset($options['attributes']['class'])) {
1450      $options['attributes']['class'] .= ' active';
1451    }
1452    else {
1453      $options['attributes']['class'] = 'active';
1454    }
1455  }

// $Id: shortcut.module,v 1.2.2.2 2008/10/08 21:49:30 karpuz Exp $
264 function theme_shortcut_admin_list($shortcuts = array()) {
265  $headers = array(t('Shortcut'), t('Description'), t('Actions'));
266  $rows = array();
267  foreach ($shortcuts as $shortcut) {
268    $shortcut_string = shortcut_shortcut_to_string($shortcut);
269    $rows[] = array(
270        $shortcut_string,
271        $shortcut['title'],
272        l(t('Edit'), 'node/' . $shortcut['nid'] . '/edit', drupal_get_destination())
273        . ' | '
274        . l(t('Remove'), 'node/' . $shortcut['nid'] . '/delete', drupal_get_destination())
275      );
276  }
277  $output = l(t('Add a new shortcut'), 'node/add/shortcut', drupal_get_destination());
278  $output .= theme('table', $headers, $rows, array('class' => 'shortcut_admin_list'));
279  return $output;
280 }

See http://drupal.org/files/issues/shortcut_6_1_314740.patch
+++ shortcut.module 2008-10-09 11:46:24.000000000 +0000
+ $output = l(t('Add a new shortcut'), 'node/add/shortcut', array(drupal_get_destination()));

At first the patch suggestion to change line 277 from drupal_get_destination() to array(drupal_get_destination()) is successful and access to admin/settings/shortcut does no produce an error, however once any Keyboard Shortcut nodes are created the result is the same fatal error. Building on the suggestion, when all 3 references (lines 272, 274, 277) are changed to and then admin access is successful. Without these changes shortcuts do not seem to execute.

In addition to the Fatal error issue there seems to be additional issues with internal/external URL settings. If "Type of action or URL" is changed at any point from "Go to an Internal URL" (ie node/add) to "Go to an External URL" (ie http://www.google.com) the result is the external URL is getting a prefix of the Drupal base path, ie:

  • http://site.com/http://www.google.ca
  • At first attempt, after array(drupal_get_destination()) edits, the Keyboard Shortcuts for external URLs worked successfully but once any edits or change from external to internal are made URLs get the base path prefix (ie double http://). Removing all Keyboard Shortcut nodes (reflected in database shortcuts table) and then trying again results in the same base path prefix for external URLs. The s_type field (0,1,2) used to identify type of shortcut is corrrectly showing while related s_action field (admin/settings, anyfunction(), www.google.ca) is also correct so this does not seem to be a database issue.

    From the 3 Shortcuts I've created (PATH 0, FUNCTION 1, EXTERNAL 2) Mozilla Firebug shows the following Javascript output (keys codes removed ie*,) in the HTML header:

    shortcutsDown.push({ie *, func_name:"shortcut_call_path", param:"http://www.google.ca" });
    shortcutsDown.push({ie *, func_name:"anyfunction()", param:"" });
    shortcutsDown.push({ie *, func_name:"shortcut_call_path", param:"node/add" });

    I believe "shortcut_call_path" string needs to be removed from s_type 3 (EXTERNAL) shortcuts but I have been unable to determine where the logic structure is in the module to do so.

    In summary, it looks like the array suggestion needs to implemented while the s_type 3 (EXTERNAL) logic may need tweaking.

    Other Suggestions:

  • Javascript has processShortcutDown(e) : Might it be possobile to create processShortcutUp for js functions only? Form would need to be changed so UP/Down toggle js script action is logical.
  • Could tips/warings be added to admin or create forms to inform about default keys use in Windows & Mozilla.
  • #1

    Babalu - November 14, 2008 - 10:40

    on my site too

    Fatal error: Unsupported operand types in /var/www/web3/html/includes/common.inc on line 1445

    #2

    mziegmann - January 14, 2009 - 00:18

    Subscribing - seeing this error as well

    #3

    rCharles - January 14, 2009 - 03:46

    I have not reviewed or followed up on my earlier note. I hope to try over the next few days.

    #4

    mitraz - September 13, 2009 - 01:11

    I am getting the same error. Could be a useful mudule. Is this module supported anymore?

    #5

    silverhosting - October 14, 2009 - 01:23

    i just installed it. Got the same error. Is this module supported anymore???

     
     

    Drupal is a registered trademark of Dries Buytaert.