Drupal error fix: Fatal error: Unsupported operand types in ../common.inc on line 1426

If you`re using drupal, you might encounter this error, when upgrading to Drupal 6.16:
Fatal error: Unsupported operand types in path_to_drupal/includes/common.inc on line 1426
It happened to me when I tried to create a node that is unpublished (“Published” checkbox is unchecked) or trying to unpublish a published node.
There various modules that conflict with the 6.16 drupal core common.inc file which is changed in 6.16.
This is a fast fix of core file and it works for me.
Open up the includes/common.inc file, search for:

function url($path = NULL, $options = array()) {

(around line 1418)

Replace this code:

$options += array(
'fragment' => '',
'query' => '',
'absolute' => FALSE,
'alias' => FALSE,
'prefix' => ''
);

with this:

if (!is_array($options)) {
$options = array();
$args = func_get_args();
if (isset($args[1])) $options['query'] = $args[1];
if (isset($args[2])) $options['fragment'] = $args[2];
if (isset($args[3])) $options['absolute'] = $args[3];
}

Search for this line:
function l($text, $path, $options = array()) {

Replace code:

$options += array(
'attributes' => array(),
'html' => FALSE,
);

with:

if (!is_array($options)) {
$options = array();
$args = func_get_args();
if (isset($args[2])) $options['attributes'] = $args[2];
if (isset($args[3])) $options['query'] = $args[3];
if (isset($args[4])) $options['fragment'] = $args[4];
if (isset($args[5])) $options['absolute'] = $args[5];
if (isset($args[6])) $options['html'] = $args[6];
}

Save the common.inc file, you should be done!
Tell me if it worked for you!

Author: Valters Bože

abstract person

3 thoughts on “Drupal error fix: Fatal error: Unsupported operand types in ../common.inc on line 1426”

  1. Hi,

    thanks for that tip. It seems to have fixed my problem on Drupal 6.19. I still however can’t seem to find the module that caused the problem in the first place. I will post here again if there are any issues with this method of fix.

    Cheers.

Leave a Reply

Your email address will not be published. Required fields are marked *