Closed (fixed)
Project:
Drupal 6 Long Term Support
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 May 2021 at 19:41 UTC
Updated:
14 Jul 2021 at 18:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
izmeez commentedIssue title accidentally left incomplete, now updated.
Comment #3
izmeez commentedThe line this warning points to is the last line of the helper function:
leading me to wonder if it is related to the changes introduced in #3022040: [views_bulk_operations] php strict warnings that only apply when changes are made to views-6.x-2.x described in that issue.
Comment #4
roderikIt's a different cause.
Issue
function og_add_group_action_submit($form, &$form_state) {cannot* be called withcall_user_func()- becausecall_user_func()always passes arguments by value, never by reference. Which doesn't work for the function definition which wants a reference -> it complains*.* From memory: I think this is the case since PHP5.4 because that was the version that changed things around references. Or was it 5.3?
Solution
Change
call_user_func($action_submit, $form, $form_state);to$action_submit($form, $form_state);.There's no reason for using call_user_func(), basically. (call_user_func_array() has its use because it has a variable number of parameters. With a fixed number of parameters, you can just call a variable function.)
I haven't tried this myself, but it is supported by
Comment #5
izmeez commented@roderik Thank you for taking a look at this. Attached is a patch as you suggested and with php 7.3 it appears to resolve the warning. I assume this is a patch that other users of vbo may need to consider.
The other issue, that of duplicate entries in the view after executing the addition of another group is indeed related to the need to ensure the view has the distinct setting enabled.
Comment #6
roderikBetween the two of us, your testing and the undisputed fact that
call_user_func($function, ...)can always be replaced by$function(...)(regardless of PHP version)... this is enough for me to set RTBC.Comment #7
izmeez commentedThanks. I'm happy to have one more warning crushed which might raise it's head as a fatal error with php 8 and really appreciate having someone else to bounce things off. At least it's here for anyone else who comes looking and maybe it will find it's way into the module. Not something we need to hold our breath for thanks to drush make.
Comment #8
dsnopekThanks!
Committed:
https://github.com/d6lts/views_bulk_operations/commit/eda01f38e79aeac588...