Download & Extend

PHP5.3 error: warning: Parameter 1 to imagefield_widget() expected to be a reference

Project:Image FUpload
Version:6.x-3.0-rc2
Component:User interface
Category:bug report
Priority:critical
Assigned:mpsomas
Status:needs work

Issue Summary

warning: Parameter 1 to imagefield_widget() expected to be a reference, value given in C:\xampp\htdocs\includes\module.inc on line 450.

Comments

#1

i have same error since my host updgraded from php 5.2 to php 5.3. here is the patch that fixes imagefield and imageapi if that helps. it just looks like fupload needs fixing.

http://drupal.org/node/540486#comment-2234402

#2

Title:i have the following error» PHP5.3 error: warning: Parameter 1 to imagefield_widget() expected to be a reference
Category:support request» bug report
Status:active» needs review

module_invoke() doesn't handle passing by reference. Changing the call to call_user_func() will fix the issue. See attached patch.

AttachmentSize
php53.patch 959 bytes

#3

Thanks for the patch - what version does it work with? My patching software cant find the .orig module - which file should this be applied to?

Thanks, Joe

#4

try to see if this one works, only edited the previous one.

AttachmentSize
image_fupload-619632.patch 954 bytes

#5

I've been getting this error message too, although for me it is line 462, on OSX with MAMP 1.9

"warning: Parameter 1 to imagefield_widget() expected to be a reference, value given in /Applications/MAMP/htdocs/mydrupal6/includes/module.inc on line 462."

When I applied the patch the error message goes away on the create content page

but on the edit content page I now get more errors (previously on this page it was also the same error message I quoted above)

"warning: Parameter 1 to theme_image_fupload_imagefield_widget() expected to be a reference, value given in /Applications/MAMP/htdocs/mydrupal6/includes/theme.inc on line 656.
warning: Parameter 1 to theme_image_fupload_imagefield_widget() expected to be a reference, value given in /Applications/MAMP/htdocs/mydrupal6/includes/theme.inc on line 656."

I should say, I am a relative newbie, and this is only my second patch attempt (the first was successful), it may be something I am doing, or something obvious. I ran this patch on my "image_fupload_imagefield" directory using terminal.

In the mean time I am going to have to stop using this module :(

cheers

matt

#6

Drupal system requirements are detailed here:

http://drupal.org/requirements

"PHP 5.3 is not yet supported by Drupal 5.x, but is supported by Drupal 6.14 core and higher (see the release notes for 6.14) and also by Drupal 7.x. Note that some contributed modules may not be compatible with PHP 5.3, and that some PHP 5.3 configurations still show warnings with Drupal 6.14; work is ongoing to resolve the latter in #360605: PHP 5.3 Compatibility."

DT

#7

changed back to 5.2, the error message seems to be gone :)

matt

#8

Status:needs review» closed (duplicate)

I am marking this as a duplicate of #581074: Widget does not show up. (PHP 5.3.0). You can follow up on that issue to track its status instead. If any information from this issue is missing in the other issue, please make sure you provide it over there.

#9

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

This is not a duplicate. This is a separate patch and the correct way to solve this as module_invoke() doesn't pass by reference. #2's patch is the best approach. I've tested the patch and it's good. Changing to 'Reviewed & tested'.

#10

Thank you, Justin. I can confirm the patch works for me, too (php 5.3.1).

#11

Status:reviewed & tested by the community» needs work

Hi,

I confirm that the patch is not working when editing an existing node, and same error as #5

warning: Parameter 1 to theme_image_fupload_imagefield_widget() expected to be a reference, value given in /var/www/prod_clone/includes/theme.inc on line 656.

PHP version: 5.3.3

#12

I confirm the same as #11. The patch fixes creating images, but not editing them. We still get the error, on Drupal 6.19 with php5.3...

warning: Parameter 1 to theme_image_fupload_imagefield_widget() expected to be a reference, value given in /home/xxxxx/public_html/includes/theme.inc on line 656.

#13

subscribe

#14

subscribe

#15

Identical Drupal 6.19 installations on two sites.
using

FileField 6.x-3.7
ImageField 6.x-3.7
Image FUpload 6.x-3.x-dev or Image FUpload 6.x-3.0-rc2 ( I tried both with identical results )

works on this older server...
MySQL database 5.0.51a
PHP/5.2.4-2ubuntu5.10
Web server Apache/2.2.8 (Ubuntu)

does not work on newer install of Ubuntu 10.04 lts
warning: Parameter 1 to imagefield_widget() expected to be a reference, value given in /usr/share/drupal6/includes/module.inc on line 462.
on edit content page

MySQL database 5.1.41
PHP 5.3.2-1ubuntu4.5
Web server Apache/2.2.14 (Ubuntu)

There is a problem with this Image FUpload on new installations of Apache/PHP

confirm experience of #5

#16

Same problem:

warning: Parameter 1 to imagefield_widget() expected to be a reference, value given in /var/www/drupal/includes/module.inc on line 462.

subscribing!

#17

My errors seemed to have disappeared. I'm using PHP 5.3.2. I did the following:

Applied the patch php53_0 from post #1.

And then I omited the '&' sign in the following files:

'image_fupload_imagefield_widget.inc' in the image_fupload module and 'imagefield_widget.inc' in the imagefield module.

Change:

function theme_image_fupload_imagefield_widget(&$element) {

to:

function theme_image_fupload_imagefield_widget($element) {

Post back if it works for you.

#18

#17 worked for me. Tnx!

#19

#1 & #17 do *not* work for me. Patch from #1 is not applyable because ImageAPI has a newer version (6.x-1.x-dev installed right now, but stable version tested as well).

#20

Neither #1 or #17 work for me either. Still getting the error.

#21

I'm just starting out with Drupal 6.19, php5.3.2-1 on Ubuntu4.5. Like 5 & 15, none of the patches work for me. May have to give up on this module.

#22

#17 worked for me also! Thank you!

#23

Same error here. Applied imageapi-540486-41.patch from #1 and made the first of the two ampersand-removal changes (there was one instance of &$element in the first module, and none in the second) mentioned in #17.
I am running PHP 5.3.2-1ubuntu4.2 with Suhosin-Patch and Drupal 6.19.

Please advise.

Kristin Nielsen
San Diego Zoo Global

#24

I have all modules updated now and the same error has gone away after 3 deleted ampersands:

File: "\sites\all\modules\imagefield\imagefield.module"
Line: 181
Change from: "function imagefield_widget(&$form, &$form_state, $field, $items, $delta = 0) {"
Change to: "function imagefield_widget($form, $form_state, $field, $items, $delta = 0) {"

File: "\sites\all\modules\image_fupload\image_fupload_imagefield\image_fupload_imagefield_widget.inc"
Line: 145
Change from: "function theme_image_fupload_imagefield_widget(&$element) {"
Change to: "function theme_image_fupload_imagefield_widget($element) {"

#25

Thanks That worked for me. I don't get the error any more. Problem is now that new directories aren't being created for "Photos/[user]" for the uploaded files. Everything just goes into "Photos" directory.

#26

This fix (#24) worked for me too! Latest version of core and all modules. Thanks so much for the time and effort on this module - where has it been all my life??!!

I'm no programmer - is this likely to affect any thing else? Have multiple sites hosted using the imagefield module.

Thanks again,

Andrew

PS - Also same issue with all files being dumped in the sites/files directory

#27

Great module this.

As it seems to be no longer maintained - are there any alternatives?

#28

At the moment, only cricital bugs can be fixed due to missing time, but it's still maintained.
Try this as an alternative module:
http://drupal.org/project/plupload

#29

Bugfix.

AttachmentSize
patch-619632-29.patch 1.83 KB

#30

Status:needs work» needs review

fix status

#31

Status:needs review» needs work

Patch in #29 requires additional fix described in #24 to work.

#32

subscribing

#33

I also get this error using all the latest modules and latest drupal 6 version. Is there is a new version of FUpload planned to work smoothly with PHP 5.3 anytime soon? http://drupal.org/project/plupload looks good, will maybe use that in the future.

#34

im not sure if its a related problem, but after i publish a node with several images, when I go to edit it, I see the error as many times as there were pictures. however, i cannot see or edit or delete any of the images i have uploaded.

#35

*note this happens when using the multiple images per node method

#36

For PHP 5.3.x user, you can use swfupload module, which works well in my Ubuntu 10.4 server.

http://drupal.org/project/swfupload

Require Jqp module: http://drupal.org/project/Jqp

Instruction:
1. Create a new directory called 'swfupload' inside the 'libraries' folder.
(sites/all/libraries)

2. Download the SWFUpload 2.2.0.1 release.
(http://code.google.com/p/swfupload/downloads/list)

3. Copy the files 'swfupload.swf' and 'swfupload.js' to the swfupload folder
inside the libraries folder. The end result will read:
sites/all/libraries/swfupload/swfupload.js
sites/all/libraries/swfupload/swfupload.swf

#37

Having same problem with latest versions of modules and Drupal.
Is there a ready-to-use patch?

#38

#24 works for me perfectly with no patch

#39

Yes, looks like #24 patch works for me too; thanks for this!

#40

Thanks ...swfupload is very good module!

#41

#24 worked for me. Thanks!

#42

Attached is a patch against 6.x-3.0-RC2 (latest recommended release) with the proposed changes from #29 (which fixes this warning for me). I realize that this patch is not applicable to the latest 6.x-3.x-dev and is only intended as a convenience for those running 6.x-3.0-RC2.

AttachmentSize
fix_expected_reference-4177954-42-D6.patch 1.4 KB

#43

Unfortunately, it doesn't fix the bug - we need a closer look at it.

#44

The patch given above in #29 and now #42 are indeed correct. But both have a dependency on the fix outlined in #24 in the imagefield module.

#45

sorry but I still have errors, I tried to apply the first patch but I get this # 29

Checking patches image_fupload_imagefield / image_fupload_imagefield.module ...
Error: while searching for:
* Assign default properties to items and delegated to filefield.
* /
image_fupload_imagefield_widget function ($ form, $ form_state, $ field, $ items, $ delta = 0) {
$ Element = module_invoke ('ImageField', 'widget', $ form, $ form_state, $ field, $ items, $ delta);
return $ element;
}

error: patch failed: image_fupload_imagefield / image_fupload_imagefield.module: 502
error: image_fupload_imagefield / image_fupload_imagefield.module: patch does not apply
Checking patches image_fupload_imagefield / image_fupload_imagefield_widget.inc ...
Error: while searching for:
/ **
* FormAPI theme function. Theme the output of an image field.
* /
theme_image_fupload_imagefield_widget function (& $ element) {
return theme ('form_element', $ element, $ element ['# children']);
}

error: patch failed: image_fupload_imagefield / image_fupload_imagefield_widget.inc: 145
error: image_fupload_imagefield / image_fupload_imagefield_widget.inc: patch does not apply

# 42 instead of the patch is successful.

But I still have these errors

Warning: Parameter 1 to file_validate_is_image () expected to be a reference, value Given in / home / sandawe / public_html / sites / all / modules / image_fupload / image_fupload.module on line 260.
warning: array_merge () [function.array-merge]: Argument # 2 is not an array in / home / sandawe / public_html / sites / all / modules / image_fupload / image_fupload.module on line 260.
warning: array_merge () [function.array-merge]: Argument # 1 is not an array in / home / sandawe / public_html / sites / all / modules / image_fupload / image_fupload.module on line 260.

thanks for your help

#46

subscribe

#47

@pmackay you no longer need to comment to subscribe to an issue, just hit the big "Follow" button on the top-right of the issue ;-)

#48

Priority:minor» critical

Patch at #42 works for me.
Changing this issue to critical because without the patch, this module doesn't work at all.

#49

Same problem. Will downgrade to php 5.2 resolve this problem? Or is new version of this module comming soon?

#50

Thanks Kyberman. This worked great for me. Much appreciated!

#51

#52

#42 patch works fine for me, but appears something strange.
I early tested 6.x-3.0-RC2 version in a local server and i had no bugs...maybe i upgraded to D6.26 core first to install Fupload ?
In online site with D6.24 i had to apply #42 patch for avoid error.
I'm no techical..it's right my thing?

#53

#42 worked for me after upgrading to php 5.3.2 and I am using fupload 6x-3.0-RC2.

#54

#42 works fine for me
Thank you @pdrake
I'm using PHP 5.3.15, Drupal 6.26 and fupload 6x-3.0-RC2

nobody click here