[SOLVED][Drupal Errors] [Drupal 6] Fatal error: Unsupported operand types in common.inc

| | 2 min read

Many Drupal users have encountered a "Fatal error: Unsupported operand types in common.inc" error message in their Drupal site. If you are faced with an error of a similar type in your Drupal site then read on to find out more about the issue.

The cause of the error lies with the fact that Drupal modules containing the url() function which have been ported from Drupal 5 to Drupal 6 did not completely follow the new standards set in Drupal 6 for the url() function. To locate the modules which have the sick code we need to do the following steps.

  • Go to
    /includes/common.inc
  • Locate the url() function
  • Change the following code in the function from
    <?php
    function url($path = NULL, $options = array()) {
      // Merge in defaults.
      $options += array(
        'fragment' => '',
        'query' => '',
        'absolute' => FALSE,
        'alias' => FALSE,
        'prefix' => ''
      );
    ?>

    to the following

    <?php
    function url($path = NULL, $options = array()) {
      if (!is_array($options)) {
        echo "&lt:pre>";
        $backtrace = debug_backtrace();
        var_export($backtrace[0]);
        die();
      }
      // Merge in defaults.
      $options += array(
        'fragment' => '',
        'query' => '',
        'absolute' => FALSE,
        'alias' => FALSE,
        'prefix' => ''
      );?>
  • This will ensure that instead of an error you will get an array like the one shown below
  • array (
      'file' => '/www/drupal-6/sites/all/modules/admin_links/admin_links.module',
      'line' => 65,
      'function' => 'url',
      'args' => 
      array (
        0 => 'node/62/edit',
        1 => NULL,
        2 => NULL,
        3 => true,
      ),
    )
  • The file line will give a clue to which module is the culprit.
  • Once you have located the module go the module's issue queue to see if anyone has reported the issue.
  • Otherwise file a bug report so that the maintainer can fix the problem.

Hope that helps.

The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more.