[SOLVED][Drupal Errors] [Drupal 6] Fatal error: Unsupported operand types in common.inc
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 "<: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,
),
)
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.
Reference: http://drupal.org/node/362799