I'm getting this error message on node/add forms where the I'm using the openlayers_geocoder cck widget:
warning: Parameter 1 to openlayers_cck_widget() expected to be a reference, value given in /.../includes/module.inc on line 462.
Line 462 in module.inc refers to the module_invoke() function, which ol_geocoder is using to invoke the openlayers_cck_widget functions. This is a PHP 5.3 compatability issue. The function signature for hook_widget requires the $form and $form_state parameters to be passed by reference. Unfortunately module_invoke() does not pass arguments by reference, and as a result PHP 5.3 is causing a warning message to be displayed on the node/add form.
As a quick fix, the function signature from:
function openlayers_cck_widget(&$form, &$form_state, $field, $items, $delta = 0)
to:
function openlayers_cck_widget($form, $form_state, $field, $items, $delta = 0).
I've been scratching my head trying to come up with a better way to fix this. I'm very new at this. My first thought is to include the code from the openlayers_cck.module file and call the widget functions directly. So far I haven't been successful at doing that, and I'm not sure its even legitimate.
Comments
Comment #1
ccardea commentedNote that an issue has been raised in core regarding the inability of the module_invoke function to pass parameters by reference. The issue is complicated because PHP has stated that call-time passing of parameters by reference is deprecated. I've attached a patch that provides a solution until the issue can be resolved regarding call-time passing of parameters by reference.
Comment #2
dasjojust noting that those lines end with unneccessary blanks
Powered by Dreditor.
Comment #3
ccardea commentedI'm glad somebody noticed.
Comment #4
xamanu commentedhere comes the patch without the spaces at the end of the line, that dasjo mentioned :-)
It actually works for me. Thanks!
Comment #5
rahulbot commentedWorked great for me - thanks!
Comment #6
barrapontoWorks for me as well.
Comment #7
brunorios1 commentedworked for me too.
thanks!
Comment #8
barrapontochanging status
Comment #9
steinmb commentedIf RTBC, any chance of getting this commited? What core issue number is the description text referring to?
Comment #10
steinmb commentedBumping
Comment #11
aerozeppelin commentedThank you!
#1 Worked for me.
Comment #12
barraponto@steinmb i want this committed too, but it is not a major bug. it is just a warning.
Comment #13
steinmb commentedYeah, I know. I raised the priority more as an desperate act to get the developers attention :) 5 months as RTBC..
Comment #14
barraponto@steinmb if you have the time, please step up as comantainer. just create an issue and let's see what the mantainer says.
Comment #15
leramulina commentedI have
Drupal 6.24
CCK 6.x-3.0-alpha3
Openlayers 6.x-2.0-beta1
Geocoder 6.x-2.0-alpha5
And it did not help me
Comment #16
steinmb commentedWarnings are never critical. That aside, did you apply the patch in #4, and what PHP version are you getting this warning on?
Comment #17
leramulina commentedYes, I applied.
I have version PHP: 5.3.8
Comment #18
leramulina commentedI get this:
Fatal error: Cannot redeclare ol_module_invoke() (previously declared in C:\xampp\htdocs\expat\sites\all\modules\openlayers_geocoder\openlayers_geocoder.module:188) in C:\xampp\htdocs\expat\sites\all\modules\openlayers_geocoder\openlayers_geocoder.module on line 207
Comment #19
steinmb commentedReviewed and tested on
* Drupal 6.26
* Openlayers Geocoder 6.x.2.x-dev
* PHP 5.3.5
Rerolling #4. The workaround still works. perhaps not the most elegant way of removing those warnings in PHP 5.3 but as long as it works.
Comment #20
steinmb commentedRemoved one trailing white space found in #19.
Comment #21
steinmb commentedHave been given commit access.
Commited: http://drupalcode.org/project/openlayers_geocoder.git/commit/d7ccc48