Download & Extend

Widget does not show up. (PHP 5.3.0)

Project:ImageField
Version:6.x-3.10
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:php5.3

Issue Summary

Using Drupal 6.14 with PHP 5.3.0, i get this error instead of the imagefield_widget:

warning: Parameter 1 to theme_imagefield_widget() expected to be a reference, value given in C:\server\htdocs\drupal\includes\theme.inc on line 617.

Comments

#1

Status:active» fixed

I've committed this patch which should correct this problem.

AttachmentSize
image_field_remove_reference.patch 692 bytes

#2

Status:fixed» closed (fixed)

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

#3

I have same error on php 5.3.

#4

Is there a plan to roll this into a release of imagefield?

#5

This problem can be resolved by removing in the file imagefield_widget.inc the & in the function. That is,

function theme_imagefield_widget(&$element) -> function theme_imagefield_widget($element)

#6

Status:closed (fixed)» reviewed & tested by the community

Patch in #1 is working, please apply to source.

Thanks.

#7

Status:reviewed & tested by the community» closed (fixed)

This has been committed ever since I marked fixed in #1.

#8

Hi,

Similar issue here: with an when editing a node with an imagefield this error message is displayed.

warning: Parameter 1 to imagefield_widget() expected to be a reference, value given

How can I solve this?

Richard

#9

Hi,

I get the same problem here - using php 5.3 but only seems to be a problem when using with the image_fupload module??

Richard did you solve this?

Any help much appreciated,

Thanks, joe

#10

looks like a similar problem occurs with the image_fupload module and that's probably the source - there is a patch here - http://drupal.org/node/619632 - will post back when tried

#11

this is still happening in the latest stable release:

In the file image_fupload/image_fupload_imagefield/image_fupload_imagefield_widget.inc, the theme function should not take $element as reference as it is now, at least, changing it to a normal argument seems to have fixed the problem on my test install:

<?php
/**
* FormAPI theme function. Theme the output of an image field.
*/
function theme_image_fupload_imagefield_widget($element) {
  return
theme('form_element', $element, $element['#children']);
}
?>

#12

Project:ImageField» Image FUpload
Version:6.x-3.1» 6.x-3.0-rc2
Status:closed (fixed)» needs review

Changing project.

#13

I'm getting the same problem with ImageField 6.x-3.7 since using PHP 5.3. Patch from #1 doesn't seem to be enough.

This issue was 'kidnapped' by another module, doesn't look correct to me. Can we move it back to imagefield?

#14

To add: I don't use the Image FUpload module.

#15

Project:Image FUpload» ImageField
Version:6.x-3.0-rc2» 6.x-3.x-dev

To add: I don't use the Image FUpload module.

#16

Status:needs review» closed (fixed)

This problem has been fixed in ImageField for months. Please do not reopen again.

#17

Sorry. I just forwarded it.

#18

theme_imagefield_widget() expected to be a reference, value given in /usr/share/drupal/core/includes/theme.inc on line 656

I have applied the previous patch but this is still occuring.

Php 5.3

Please advise

Thank you in advance

#19

#5 works for me.

I removed the &

#20

Im getting the error
warning: Parameter 1 to imagefield_widget() expected to be a reference, value given in includes/module.inc on line 462.

using the latest stable release.
php 5.3

#21

Version:6.x-3.x-dev» 6.x-3.9
Priority:normal» critical
Status:closed (fixed)» active

Changed:
./sites/default/modules/linkimagefield/linkimagefield_widget.inc:function theme_linkimagefield_widget(&$element) {
to:
./sites/default/modules/linkimagefield/linkimagefield_widget.inc:function theme_linkimagefield_widget($element) {

Problem went away and seems to work fine.

#22

Priority:critical» normal
Status:active» closed (fixed)

@pcoughlin: This has already been corrected. Use the latest version.

#23

Version:6.x-3.9» 6.x-3.10
Status:closed (fixed)» active

Oops. Wrong thread.

#24

Status:active» closed (fixed)

#25

Priority:normal» critical
Status:closed (fixed)» active

As per #20, I have the same problem: The by-reference passing throws a warning at imagefield_widget() calls through module.inc. This happens with the latest stable release 6.x-3.10 running on PHP 5.3 (enforced by hosting provider for security reasons, no workaround available), and I see that the latest code in repository is not changed here.

This is critical, because it's a data-loss issue. A CCK content type uses imagefield (with Image FUpload). Initial creation of a node works more or less fine, but once the node is later edited (to update textual description in another field, typically), on submit of the node form, image is unintentionally deleted. If I remove the two '&' signs from the function definition then it works fine, but it's going clearly against the documented fact that 'FileField needs to modify $form by reference', so I guess this needs more consideration. I guess this is related to the fact that PHP 5.3 not only throws warning if a value is given in a by-reference call, but it also discards that value and passes a NULL into the function instead.

#26

@JirkaRybka: Make a suggestion (through a patch) and I'll look at it. As far as I know this is solved. I've been running PHP 5.3 in production on many sites with ImageField.

#27

Just ran into this after a server wide upgrade to PHP 5.3.x branch.
Coincidentally we had two content types on a particular site, both using the Image File field type, however one was showing, one was not and throwing the error.
The difference was in the "Widget Type" setting - "Link Image" was not working, "Image" was.
After changing the Widget Type to Image I was back up and running.
Add and Edit node forms both functioning with no other changes.
I did however take the opportunity to update to latest versions of ImageField and FileField.

#28

for Posted by ifernando ...

thank u very much..

#29

Priority:critical» normal
Status:active» closed (fixed)

This problem was fixed long, long ago. The pass-by-reference in theme_imagefield_widget() has been fixed since September 18th, 2009 (the same day this issue was filed, see http://drupalcode.org/project/imagefield.git/commitdiff/62265aec4b64c108...). Please do not, for any reason, reopen this issue. File a new issue if you having trouble with ImageField and PHP 5.3 specifically.

#30

#21 fixed my issue.

nobody click here