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.
CommentFileSizeAuthor
#1 image_field_remove_reference.patch692 bytesquicksketch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Status: Active » Fixed
FileSize
692 bytes

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

Status: Fixed » Closed (fixed)

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

dom_b’s picture

I have same error on php 5.3.

quinn-2’s picture

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

ifernando’s picture

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)

koorneef’s picture

Status: Closed (fixed) » Reviewed & tested by the community

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

Thanks.

quicksketch’s picture

Status: Reviewed & tested by the community » Closed (fixed)

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

rdgouw’s picture

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

joecanti’s picture

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

joecanti’s picture

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

Manuel Garcia’s picture

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:

/**
 * FormAPI theme function. Theme the output of an image field.
 */
function theme_image_fupload_imagefield_widget($element) {
  return theme('form_element', $element, $element['#children']);
}
cha0s’s picture

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

Changing project.

yan’s picture

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?

yan’s picture

Issue tags: +php5.3

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

grandcat’s picture

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.

quicksketch’s picture

Status: Needs review » Closed (fixed)

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

grandcat’s picture

Sorry. I just forwarded it.

rufpoet’s picture

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

chrisck’s picture

#5 works for me.

I removed the &

loze’s picture

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

pcoughlin’s picture

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.

quicksketch’s picture

Priority: Critical » Normal
Status: Active » Closed (fixed)

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

ratinakage’s picture

Version: 6.x-3.9 » 6.x-3.10
Status: Closed (fixed) » Active

Oops. Wrong thread.

ratinakage’s picture

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

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.

quicksketch’s picture

@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.

ben.hamelin’s picture

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.

iwan_s’s picture

for Posted by ifernando ...

thank u very much..

quicksketch’s picture

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.

hockey2112’s picture

#21 fixed my issue.