0

I have upgraded Drupal 6 to latest version 6.36 and PHP to 5.6. I am getting Fatal error saying;

Unsupported operand type while accessing admin/content/node.

Which is actually nothing but simple addition of an array to variable;

$elements += array('#title' => NULL, '#description' => NULL);

Any help?

2
  • 2
    The $elements variable probably contains an array element that the key does not start with a hash sign and the value is scalar.
    – AKS
    Commented Aug 12, 2015 at 11:00
  • Why haven't you read Drupal's system requirements page before doing it? I used to be like that, too. "Read instructions... when all else fails". It's pretty stupid thing in the long run, trust me.
    – Mołot
    Commented Aug 12, 2015 at 20:52

1 Answer 1

1

From official system requirements:

PHP 5.3.x and higher may produce errors or unexpected behavior

Thus, sadly, what you are seeing is pretty much "expected" unexpected behaviour. Drop back to PHP 5.2.x (x ≥ 5) or upgrade to Drupal 7 or 8 for a full fix.

If you want to only fix this one, consider what AyeshK wrote in comment:

The $elements variable probably contains an array element that the key does not start with a hash sign and the value is scalar.

There is a lot of things about array operators. Comments under PHP documentation shows that many things are far from obvious. Also, it changed a bit from version to version. Have you tested if $elements is an array in the first place? "Simply" add tests to make sure if operand is still valid, and provide a fallback if it isn't (recreate original behaviour) and you will be good to go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.