After an upgrade from alpha1 to alpha2, I get this fatal error when rendering the map. Someone else described the error here as well: https://drupal.org/node/1225346#comment-4848228 Also tried with dev, and the problem persists.

By adding an is_object() into the foreach, the problem visibly goes away, but I haven't had the time to analyse what other consequences this might have.

The crash occurs because of of the values in the $layers array is not an object, but just an integer, 0, in my case. Guessing that where ever the layers are added to this array, an extra check for valid data should be made?

I'm marking it critical as it crashes php, and in my case, pretty much takes down the entire site. I'm a bit surprised however to see that no one else has reported this, so perhaps it's not as important as I think?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

friedjoff’s picture

Status: Active » Needs review
FileSize
387 bytes

It seems this error is caused by layers that aren't available anymore but still referenced in a map configuration. At least this is how I came across this error.

Attached is a small patch that removes each layer from the layers array, if the layer can't be loaded as an object.

Jan van Diepen’s picture

I didn't want to remove the layers from my presets/maps so I dug a little deeper into the code.
In the first loop the $layers array is redone. Every value (the layer name) is overwritten by the actual layer object, but only when it is available. So after that first loop we have a mixed array with both layer names and layer objects.
So in the second loop I added an extra check to see if the value in the layers array is an object.

Please find the patch below.

zzolo’s picture

Status: Needs review » Fixed

Thanks for the patches, both. I went with patch by @Jan van Diepen.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.