Can't pass vars by reference with module_invoke_all()
| Project: | Ubercart Auction |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Hi Garrett
Trying to find out why the hook_auc_update() ignored my changes completely, I discovered something. You can't use module_invoke_all if you want to pass variables by reference.
I think the problem is, that this function in turn calls the available hook functions, and so the $node and $record variables that are declared as reference variables refer to the instances of $node and $record in module_invoke_all() and not in uc_auction_nodeapi. So changes get ignored.
See this topic regarding this: http://drupal.org/node/353494
So a solution could be to make you own invoking function just like drupal did for their hooks with reference values, or instead move away from reference values and instead have the hooks return a modified $record array.
