Fatal error: Unsupported operand types in common.inc on line 1369

bomarmonk - December 30, 2008 - 03:37
Project:Drupal
Version:6.9
Component:base system
Category:bug report
Priority:critical
Assigned:Unassigned
Status:won't fix
Description

Disabling poormans cron makes one of these errors go away with Drupal 6.8. It looks like a common problem with contributed modules.

#1

bomarmonk - December 30, 2008 - 03:58
Status:active» closed

Nevermind: this was actually caused by the e-journal module!

#2

kenorb - January 14, 2009 - 02:46
Project:Poormanscron» Drupal
Version:6.x-1.x-dev» 6.8
Component:Code» base system
Status:closed» postponed (maintainer needs more info)

The same problem, but I don't have e-journal module.
I've did some changes in Filtered HTML Filter and now when I'm going to admin/settings/filters/1 or many other pages I've got blank screen with the same fatal error:

PHP Fatal error:  Unsupported operand types in /home/sites/co.uk/public_html/includes/common.inc on line 1369

In line 1369 there is array:

function url($path = NULL, $options = array()) {
  // Merge in defaults.
  $options += array(
    'fragment' => '',
    'query' => '',
    'absolute' => FALSE,
    'alias' => FALSE,
    'prefix' => ''
  );

Issue: $options argument received NULL from some unknown module.

#3

kenorb - January 14, 2009 - 02:48
Status:postponed (maintainer needs more info)» needs review

My solution was to add following validation line before $options line:

  $options = is_array($options) ? $options : array();

Then I can disable my broken filters back (without restoring my whole database from the backup).

So it should looks like:

function url($path = NULL, $options = array()) {
$options = is_array($options) ? $options : array(); // validate $options input
// Merge in defaults.
$options += array(
'fragment' => '',
'query' => '',
'absolute' => FALSE,
'alias' => FALSE,
'prefix' => ''
);

And of course I know that Drupal doesn't support invalid modules and I'm a clairvoyant and I should know which module from around 123 is broken in few seconds.
And I'll spend whole week for searching which module was buggy and the users on production until this time will see the blank screen.
I think it's a bad goal, because it's always and it will be a nightmare for developers.

In case if this condition were already in Drupal, then maintainer of the module should worry why some argument is not passing throught, instead of breaking the whole working website to inform all users of the website, that some module is broken.

Google Results about 287 for "common.inc on line 1369"

#5

kenorb - January 14, 2009 - 03:10

In my case the real solution was to upgrade links from beta11 to beta12

#6

yhager - January 19, 2009 - 16:14

If the idea in #3 is the right direction, I can prepare a patch.
I think defensive programming is generally a good idea, so core should not break with misbehaving modules.

#7

jcmarco - January 22, 2009 - 18:04
Version:6.8» 6.9

I found the same bug when anonymous user was accessing to information out of the home page.

I don't have nor links neither e-journal. I will try to find what module is causing the problem.

Buy I agree with #6, by the way the solution in #3 solved my problem.

Here is my patch for #3

AttachmentSizeStatusTest resultOperations
url_options_validation.patch428 bytesIgnoredNoneNone

#8

jcmarco - January 22, 2009 - 19:56

By the way, in my case was community tags

http://drupal.org/node/294397

The bug was reported, fixed and created a patch three weeks ago, but the maintainer it is not updating anything since August.

#9

Dave Reid - January 22, 2009 - 21:35
Status:needs review» fixed

Since this seems to happen frequently with improperly-converted contrib modules, I have created a new Troubleshooting FAQ page about this error that explains how to debug this problem and find the offending module. So now I'm marking this as fixed since Drupal core does not babysit broken code. It is up to the module maintainers to write and test their code.

#10

kenorb - January 23, 2009 - 01:43

Fixed even it's not fixed, as always;p
And the Drupal users are the most injured.
Appeal: #362931: Automated testing for contrib modules
Please vote;)

#11

Dave Reid - January 23, 2009 - 01:54
Status:fixed» won't fix

Ok, then I'll set the more appropriate status. I know it sucks when contrib modules don't use the correct code, but there are too many places just like this where we could baby-sit broken code, or just ignore something that should be an error. It should be an error so that the module can be fixed. I went out of my way to create documentation on how to debug this error, but there's nothing that Drupal core can do.

#12

kenorb - June 18, 2009 - 12:57

See this document as well:
http://drupal.org/node/362799 (Fatal error: Unsupported operand types in common.inc)

 
 

Drupal is a registered trademark of Dries Buytaert.