When adding an image that has geocoded value, aka a cck field, geospatial data, refrence the image, and displaying the image as a node after saving this error is put on the top of the page...

warning: Parameter 1 to geo_mysql_spatial_add_field() expected to be a reference, value given in /var/www/dev/sites/all/modules/geo/geo.module on line 41.

Im running Drupal 6.19 and Ubuntu 10.x which includes the dreaded php 5.3.x... plenty of posts on 5.3 have been submitted, but not sure how i could fix this..

function geo($op = NULL) {
  static $backend;

  // Load common functions.
  module_load_include('inc', 'geo');

  // Load database-specific functions.
  if (!isset($backend)) {
    $backend = geo_backend_type();
    module_load_include('inc', 'geo', 'db/'. $backend);
  }

  // Call the appropriate API function: If geo_$backend_$op exists, call that.
  // Otherwise, resort to geo_$op.  This creates a sort of inheritence system.
  $args = func_get_args();
  if($args) {
    $op = array_shift($args);
    if (!function_exists($func = 'geo_'. $backend .'_'. $op)) {
      $func = 'geo_'. $op;
    }
    if (!function_exists($func)) {
      drupal_set_message(t('Call to undefined geo operation %op', array('%op' => $op)), 'error');
      return FALSE;
    }
    return call_user_func_array($func, $args);
  }
}

line 41 is return call_user_func_array($func, $args);

Comments

gateway69’s picture

update its really this that is failing..

its in mysql_spatial.inc

function geo_mysql_spatial_add_field(&$ret, $table, $field, $spec) {
  // NOTE for now, all geometries are 2d. deal with it
  $ret[] = db_query("ALTER TABLE {%s} ADD %s %s NOT NULL", $table, $field, $spec['type']);
  db_query("CREATE SPATIAL INDEX {$table}_${field}_idx ON  {". $table ."} ($field)");

  // @@@ Error handling
  return true;
}

from PHP page

Note: There is no reference sign on a function call - only on function definitions. Function definitions alone are enough to correctly pass the argument by reference. As of PHP 5.3.0, you will get a warning saying that "call-time pass-by-reference" is deprecated when you use & in foo(&$a);.

http://www.php.net/manual/en/language.references.pass.php

any help or patches?