Hook functions that are called from module_invoke() or module_invoke_all() should not expect their parameters to be passed by reference.
See for example the notes for user_module_invoke:
We cannot use module_invoke() for this, because the arguments need to be passed by reference.
Minimum procedure to generate an error notice:
- Upload Drupal-7 on a webserver running PHP-5.3
- Choose "Minimal" install profile.
- Go to /admin/modules and activate the following modules:
- Image
- File
- Field UI
- Filefield paths
- Token
- Go to admin/structure/types/add and set the title to "Image", then click the (Save and add fields) button.
- Set the Label, name, field, and widget to "Image", "image", "Image", and "Image" respectively. Click on the (Save) button.
The following notice will be displayed:
- Warning: Parameter 1 to filefield_paths_file_insert() expected to be a reference, value given in module_invoke_all() (line 818 of includes/module.inc).
I have the associated database dump and backtrace if anyone needs to see it.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | filefield_paths-reference_variables-1005574-18.patch | 1.59 KB | pillarsdotnet |
| #8 | filefield_paths-fix_reference_variable_handling-1005574-8.patch | 1.56 KB | pillarsdotnet |
| #1 | 1005574-filefield_paths.module.patch | 499 bytes | pillarsdotnet |
Comments
Comment #1
pillarsdotnet commentedMinimum and necessary fix is to simply remove the reference from the function signature.
Comment #2
czigor commented#1 works for me.
Comment #3
pillarsdotnet commentedTagging.
Comment #4
mooselimb commented#1 worked for me too
thanks pillarsdotnet :)
Comment #5
pillarsdotnet commentedComment #6
panchoworked for me, too. RTBC.
Comment #7
Tim Jones Toronto commentedYes patch solves this problem.
If anyone could help, I still have error message:
Strict warning: Only variables should be passed by reference in filefield_paths_filefield_paths_process_file() (line 475 of C:\xampp\htdocs\sites\all\modules\filefield_paths\filefield_paths.module).
** As reported as issue here: http://drupal.org/node/1090334
Thank you.
Comment #8
pillarsdotnet commentedAnother error in reference handling. Combined patch attached.
Comment #9
pillarsdotnet commentedComment #10
Tim Jones Toronto commentedThanks - patch/fix #8 works fine.
Comment #11
pillarsdotnet commentedComment #12
johnvcross-post: marking #1090334: Strict warning: Only variables should be passed by reference in filefield_paths_filefield_paths_process_file() as duplicate.
Comment #13
panchoNote that in the other issue there is also a patch that might be worth merging in.
Comment #14
johnvThe patch from #1090334 is already in #8. Both are created by Pillarsdotnet.
Comment #15
panchoAh okay, you're right! Just wanted to make sure that nothing gets lost.
Comment #16
joelstein commented#8 works for me.
Comment #17
aidanlis commented@pillarsdotnet thanks so much for your work on this, are you able to re-roll #8 for me if necessary?
Comment #18
pillarsdotnet commentedRe-roll as requested against fresh 7.x-1.x checkout.
Comment #19
aidanlis commentedThe new patch contains only whitespace changes ...
Comment #20
pillarsdotnet commentedNot true. Read it again.
Comment #21
aidanlis commentedOh I see now, file_prepare_directory's got the reference requirement. Okay, thanks for the patch.
Comment #23
dman commentedUm, this is marked as fixed but I'm not seeing it in the current 'recommended' 7.x-1.0-beta3 2012-Feb-07
Looks like it's in -dev however.
http://drupalcode.org/project/filefield_paths.git/commitdiff/84fb63726b5...
I can confirm that -dev works as desired and fixes this.
Is it time for a version release yet?
Comment #24
burningdog commenteddman is correct - the patch isn't in 7.x-1.0-beta3 but IS in -dev (which fixes the issue). Please create a new beta release.
Comment #25
burningdog commentedSorry, let me open a new issue for this rather.