When I enable the module I immediately get this warning (see attached jpg).
After deleting the "&" before "$form_state" on line 134 in linkimagefield_widget.inc the warning no longer appears.
Is this the right solution?
If so, could you implement it in the next version because I suppose this scares off a lot of people to use this module.
For the rest, this module works just as I expected it to work.

CommentFileSizeAuthor
pass-by-reference.jpg148.78 KBhans0811

Comments

johnfyoung’s picture

good catch - I have work to do today...I'll try to upload a fix later. Removing the & is exactly what you need to do. Looks like I just copied the function prototype for imagefield_widget_process.

jackhutton’s picture

Warning: Call-time pass-by-reference has been deprecated in /home/content/s/w/2/sw2010/html/beta3/sites/all/modules/linkimagefield/linkimagefield_widget.inc on line 134

this is the error message i get..and immediately removed the module...
i'll review your fix above..but , could really use this module if it worked..
thanks

jackhutton’s picture

Status: Fixed » Active
function linkimagefield_widget_process($element, $edit, $form_state, $form) {
  $file = $element['#value'];
  $element = imagefield_widget_process($element, $edit, $form_state, $form);

  // add some help text, telling user the URL field will be viewable after the file is supplied 
  $element['upload']['#description'] = t('Once an Image is uploaded, you will ba able to supply a URL for the link.') . '<br />' . $element['upload']['#description'];
   
  $field = content_fields($element['#field_name'], $element['#type_name']);
  $element['#theme'] = 'linkimagefield_widget_item';
  
  $element['data']['url'] = array(
    '#title' => t('URL'),
    '#type' => 'textfield',
    '#default_value' => $file['data']['url'] ? $file['data']['url'] : $field['widget']['url'],
    '#description' => t('This URL will be loaded when the image is clicked'),
    '#maxlength' => 255,
  );

i modified lines 132 and 134 to remove the & as noted above..and so far, no error message..

I've been able to use the link image widget w.out problem after the fix above.. thanks alot.. very useful.. and the error message was/is offputting..

eggonbeagle..

johnfyoung’s picture

Status: Active » Fixed

actually, you should only remove the & from line 134. That is the call-time pass-by-reference. I'm uploading the fix now, though.

jackhutton’s picture

Status: Active » Fixed

hmmm

should i add the ampersand back on to line 132..after the fact? its running fine, seemingly..
thanks for the response..

johnfyoung’s picture

the function prototype on line 132 allows the $form_state variable to be modified in this function and the changes will stick after this function returns. As long as one doesn't make a change to $form_state, it shouldn't matter. This is a standard method for handling the form's state in Drupal's Form API, i.e., developers expect to receive a modifiable reference in these types of functions.

Line 134, however, is not a function protoype but rather an actual function call and PHP no longer allows explicitly passing a reference into a function. This & is there because I copied the function prototype from the imagefield_widget_process function and neglected to remove that &.

jackhutton’s picture

thanks for that explanation.
i've added it back in on line 132..

thank you again.

Status: Fixed » Closed (fixed)

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

ch_masson’s picture

I am using ver 6.x-1.x-dev and I got the same error message on line 89 of linkimagefield_widget.inc

According to thsi thread, this issue was fixed.

Or could it be a php version issue? I am using php 5.2.11

Thanks,

ch_masson’s picture

Status: Closed (fixed) » Active
sickness29’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Development or support is not planned for D6. All D6-related issues are marked as outdated in a bunch.

If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.

Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.