Drupal 7.12
Openlayer 7.x-2.0-beta1

Map displayed correctly, but lots of error occur at once:

  • Strict warning: Declaration of openlayers_behavior_attribution::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_boxselect::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_cluster::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_dragpan::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_drawfeatures::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_fullscreen::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_geolocate::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_layerswitcher::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_mouseposition::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_navigation::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_panzoom::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_panzoombar::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_permalink::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_popup::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_scaleline::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_tooltip::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_zoombox::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_behavior_zoomtolayer::options_form() should be compatible with that of openlayers_behavior::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_cloudmade::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_geojson::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_google::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_kml::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_maptiler::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_osm::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_raw::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_tms::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_virtualearth::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_wms::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_xyz::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_yahoo::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).
  • Strict warning: Declaration of openlayers_layer_type_openlayers_views_vector::options_form() should be compatible with that of openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482 of /home/site/public_html/sites/all/modules/ctools/includes/plugins.inc).

Any ideas?

Comments

rivimey’s picture

The problem is that openlayers.module defines options_form as:

  /*
   * @param $defaults default values for the form as an array
   * @return a FormAPI form
   */
  function options_form($defaults = array()) {
    return array();
  }

but the inheritors of it are using:

  /**
   * Options form which generates layers
   */
  function options_form() {
    return array(

i.e. the "defaults" are missing, which is ok when you call the routine but not ok to override it. I would assume the intention was to merge arrays with the existing one... perhaps like this:

  function options_form($defaults = array()) {
    $my_items = array (
     // my items
     );
    $my_items = array_merge($defaults, $my_items);

    return array_merge(parent::::options_form(), $my_items);
  }

However this is speculation...

choster’s picture

Issue tags: +PHP 5.4

We started seeing these messages after our environment was upgraded to PHP 5.4; we did not see them on 5.3.

On a lark, I plugged in rivimey's speculative code, but the warnings persist. When I tried to edit a map, I get a WSOD failure:

Fatal error: Cannot access parent:: when current class scope has no parent in /var/www/iw-main/dev.iwatchnews.org/iw-apache-1/sites/icij/modules/openlayers/openlayers.module on line 899

Upgrading to 7.x-2.x-dev seems to resolve the issue, so I would recommend doing that.

Yorgg’s picture

I also confirm gilzero's issue.

"openlayers_layer_type::options_form() in ctools_plugin_load_includes() (line 482)"

I get dozens of these in a view of nodes and also in the openlayers overlay.

Drupal 7.12
Openlayer 7.x-2.0-beta1

meustrus’s picture

I'm getting these messages as well. I have an explanation for why they would only show up after you upgraded to PHP 5.4: these errors are E_STRICT, and in PHP 5.4 E_STRICT was added to E_ALL. Before 5.4, E_ALL did not include these errors.

As for the code in #1, even though it's reported that it doesn't work I have a suggestion. array_merge can take any number of arguments, so you can simplify like so:

  function options_form($defaults = array()) {
    $my_items = array (
     // my items
     );
    return array_merge(parent::options_form(), $defaults, $my_items);
    // Or maybe this would make even more sense?
    return array_merge(parent::options_form($defaults), $my_items);
    // Also note that if keys are strings, there's less overhead using the + operator like so:
    return $my_items + $defaults + parent::options_form();
    // Or lastly, without creating the $my_items variable:
    return array(
      // my items
    ) + $defaults + parent::options_form();
  }
cfgregory’s picture

subscribe, I am getting the same errors.

I only get these errors after I start up my geoserver.

PHP 5.4
Postgresql 9.1.3

cfgregory’s picture

I follow the suggestion of upgrading to dev and I no longer got the errors on my home page. But I still got the errors on my module page.

I then follow meustrus's suggestion and edited openlayers.module and it fix it for me.

meustrus’s picture

So that fixes the problem? If I can get some idea what coding standards to use (i.e. which of my suggestions is appropriate) I can roll up a patch against -dev.

cfgregory’s picture

It stops the strict errors but then when I went to edit a open layer map, I got the following error:

Fatal error: Cannot access parent:: when current class scope has no parent in /home/user/Public/www/cartaroCivi/sites/all/modules/openlayers/openlayers.module on line 898

meustrus’s picture

I'm guessing you also applied the changes to class openlayers_behavior and class openlayers_layer_type. That's wrong. The options_form method for those functions should look like this (I think?):

  function options_form($defaults = array()) {
    return $defaults;
  }
meustrus’s picture

I've "upgraded" to the latest 2.x-dev and there are no more errors. I checked some of the code and the functions now appear to be correctly defined. When is the next stable release?

camorim’s picture

Yes, it looks like a duplicate of #1419438: issue strict warning.
For the next stable release there is no preview date.

camorim’s picture

Status: Active » Fixed

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

Anonymous’s picture

Issue summary: View changes

better format