click on site config -> location -> Geocoding options got the error
warning: Parameter 1 to theme_location_geocoding_options() expected to be a reference, value given in /home/mysite/public_html

I using
php 5.3.1
MySQL database 5.0.89
GMap Module 6.x-1.x-dev (2010-Jan-24)
Drupal 6.16
Location 6.x-3.x-dev (2010-Jan-23)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

spacereactor’s picture

another error when i click Map Links
warning: Parameter 1 to theme_location_map_link_options() expected to be a reference, value given in /home/mysite/public_html/includes/theme.inc on line 656.

spacereactor’s picture

anyone know how to fix, is this php 5.3 related problem?
warning: Parameter 1 to theme_location_map_link_options() expected to be a reference, value given in /home/mysite/public_html/includes/theme.inc

hutch’s picture

I am not the author of this code and do not know what the intention was, but the code on line 253 in location.admin.inc:
function theme_location_map_link_options(&$form) { should I think be function theme_location_map_link_options($form) {

The same for line 274 function theme_location_geocoding_options(&$form) { needs the "&" removing.

I cannot test this as I do not have php v5.3.x running anywhere.

Please test this and if it gets rid of the error and the theming still works then provide a patch for the maintainer's consideration.

Hope this helps

spacereactor’s picture

thank, i remove the two "&" and error message doesn't appear anymore. Can the location Maintainer team confirm and add it to the dev.

kk_alscg’s picture

Title: warning: Parameter 1 to theme_location_geocoding_options() expected to be a reference, value given in /home/mysite/public_html » warning: Parameter 1 to theme_field() expected to be a reference, value given in C:\xampp\htdocs\vhosts\default\htdocs\includes\

Hello,

I am encounter the follwoing error when accessing the page.

warning: Parameter 1 to theme_field() expected to be a reference, value given in C:\xampp\htdocs\vhosts\default\htdocs\includes\theme.inc on line 170.

Code for the function theme is as follows..

function theme() {
static $functions;
$args = func_get_args();
$function = array_shift($args);

if (!isset($functions[$function])) {
$functions[$function] = theme_get_function($function);
}
if ($functions[$function]) {
return call_user_func_array($functions[$function], $args);
}
}

I am getting error while returning the value.

Appreciate if somebody can help me with this..

spacereactor’s picture

Title: warning: Parameter 1 to theme_field() expected to be a reference, value given in C:\xampp\htdocs\vhosts\default\htdocs\includes\ » Make compatible with PHP 5.3

i not sure if this is location problem. where an when this error occur?

warning: Parameter 1 to theme_field() expected to be a reference, value given in C:\xampp\htdocs\vhosts\default\htdocs\includes\theme.inc on line 170.

YesCT’s picture

Title: Make compatible with PHP 5.3 » Parameter 1 to theme_location_geocoding_options() expected to be a reference, value given (Make compatible with PHP 5.3)

Sometime &$ is needed in the arg list so that whatever is being passed in can be *altered*

... I think ...

lets keep part of the error message in the issue title so others getting this error will find this issue too.

hutch’s picture

My (somewhat tenuous) understanding of this is that the &$ should be present in the function definition but not in the call.
so

function myfunc(&$thingy) {
  // do something to $thingy
  .....
}

and

$thingy = "something";
myfunc($thingy);
// $thingy has been altered by myfunc()

That is how I have used it and it works, but I don't know if that way generates an error in PHP5.3.x

YesCT’s picture

Yes, I think that is how I have seen it work in my recent looks into APIs....

Reg’s picture

I don't have this issue however I have seen this error in many other places so I might be able to help with some insight. It usually comes from the function "call_user_func_array" being used, often from an "invoke" such as "module_invoke_all". Reason is this:

http://us2.php.net/manual/en/function.call-user-func-array.php
Note: Referenced variables in param_arr are passed to the function by a reference, others are passed by a value. In other words, it does not depend on the function signature whether the parameter is passed by a value or by a reference.

Anyway, if this is not what's happening, sorry, it just looks like it would be. However, if this is the case check your version of Drupal because of one of the version around 6.13'ish the core was updated to be PHP 5.3 compatible and that may be all you need to make it work correctly.

astro87’s picture

My errors was:

1. Click on - Administer › Site configuration › Location > Map links

"warning: Parameter 1 to theme_location_map_link_options() expected to be a reference, value given in C:\strony_www\PHP\xampp\htdocs\drupal-6.16\includes\theme.inc on line 656."

2. Administer › Site configuration › Location > Geocoding Options

"warning: Parameter 1 to theme_location_geocoding_options() expected to be a reference, value given in C:\strony_www\PHP\xampp\htdocs\drupal-6.16\includes\theme.inc on line 656."

I removed ampersand & like in #3 and now I don't see any warnings, I think it work.

[EDITED]:

PHP 5.3.1
Drupal 6.16

sistro’s picture

The #3 works also form me!

I had also theme problems, solved with this workaround, thanks a lot!

YesCT’s picture

Please (if you have found the fix works for you or if you are posting a new review) include what your php version (and drupal version) is. I believe you can find that easily by looking under reports -> status report .

Also someone please create a patch for this suggested fix (in #3).

[edited to fix mis-spellings]

hutch’s picture

Here is a patch on latest CVS, it removes the '&' from the theme functions theme_location_geocoding_options() and theme_location_map_link_options()
I'm pretty sure this will work, I see no reason to pass a $form object to a theme by reference, it's just display munging.

YesCT’s picture

Status: Active » Needs review
lobolo-1’s picture

Hi...

#3 worked out for me...was haunted by the same warning message...

thanks...

hip’s picture

#3 did it for me too.

YesCT’s picture

lobolo and hip, as the fix from #3 is in the patch in #15, please try to apply that patch and review it so it can be committed as a proper fix to the module. :)

hip’s picture

I actually applied the patch and it did the trick.

+1 to become a proper fix ;-)

pog21’s picture

Patch in #14 worked for me.

kriskhaira’s picture

#14 works for me.

tangent’s picture

Status: Needs review » Reviewed & tested by the community

The solution is good. Let's commit this please.

bigpepper’s picture

Perfecto. This patch worked great for me. Well done.

nilu5233’s picture

Version: 6.x-3.x-dev » 6.x-3.1
Assigned: Unassigned » nilu5233

when i enter the location-> map linking
it shows me this warning
warning: Parameter 1 to theme_location_map_link_options() expected to be a reference, value given in /var/www/edu/includes/theme.inc on line 656.

i find many ways to solve but it still can't remove it

i see the way "I removed ampersand & like in #3 and now I don't see any warnings, "
but i don't understand what should i remove in theme.inc 656
it doesn't have the signal "&" and "#3"

sorry my english is very poor

thank you

hutch’s picture

in location.admin.inc, line 292: function theme_location_map_link_options(&$form)
try removing the '&'

nilu5233’s picture

thank you to reply my question
but i remove the "&", the warning is still on the page

so, what i can do it!?

rooby’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +PHP 5.3

There is no need to be modifying the $form variable in those theme functions anyway.

I have committed hutch's fix to all branches.
I also did the same for theme_location_latitude_dms() and theme_location_longitude_dms() in the D7 branch.

http://drupal.org/cvs?commit=473646
http://drupal.org/cvs?commit=473642
http://drupal.org/cvs?commit=473654

rooby’s picture

Status: Fixed » Closed (fixed)

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

Avalanche’s picture

Status: Closed (fixed) » Active

I receive, "warning: Parameter 1 to theme_location_map_link_options() expected to be a reference, value given in /var/www/ijec/includes/theme.inc on line 668."

I am using PHP version 5.3.5 and Drupal 6.22

Here is what the error points to:

666:  if (isset($info['function'])) {
667:     // The theme call is a function.
668:   $output = call_user_func_array($info['function'], $args); 
669:  }
670:  else {
671:    // The theme call is a template.
672:    $variables = array(
673:      'template_files' => array()
674:    );
675:    if (!empty($info['arguments'])) {
676:      $count = 0;
677:      foreach ($info['arguments'] as $name => $default) {
678:        $variables[$name] = isset($args[$count]) ? $args[$count] : $default;
679:        $count++;
680:      }
681:    }
rooby’s picture

Status: Active » Closed (fixed)

@aceinthehole:
This has been fixed in the dev version.
A new release is a bit overdue actually. I will get one out soonish.
Until then though the dev version will stop that error.
There are also a number of other useful fixes in there.

Avalanche’s picture

Got it -- thanks Rooby!

Marcus 78’s picture

Still get the warning: Parameter 1 to theme_location_geocoding_options() expected to be a reference, value given in error

By the way. Can this bug explain why im not getting the coordinates in my view even though i manage to get the adress and other location data?

Fidelix’s picture

Marcus 78, I'm having the same problem.
The exact same warning, and my map center is in the middle of the map, on the ocean.

lucabarbetti’s picture

I had the same problem of #30 and it has been solved using the 6.x-3.x-dev version as suggested by rooby at #31.
Thanx a lot!

Anonymous’s picture

Thanks Rooby for your answer I will move to 6.x-3.x-dev version and it worked fine for me.