When converting code from Drupal 5 to Drupal 6, call-time-pass-by references of the form function_name(&$var) are introduced in the function call.
For example, in my hook_submit, coder converts the function definition from: function mymodule_submit($form_id, $form_values){} to: function mymodule_submit($form, &$form_state){} which is fine.
But the same substitutions are performed on the function call as well. So my call to the above function also gets converted to mymodule_submit($form, &$form_state);/code> which introduces a Call-time-pass-by-reference Warning if you have <code>allow_call_time_pass_reference = Off in your php.ini
The fix:
Is there a way of altering the substition being performed based on if its a function definition vs. a function call? Call-time pass-by-reference has been deprecated.
Comments
Comment #1
girishmuraly commentedActually I realized the fallacy in my example above.
What coder does is it treats any _submit() functions as a 'hook_submit()' and performs the substitution treatments. If in fact it was a hook_submit(), then its valid to assume that that pattern string would only appear in a function definition, as we would not explicitly call a hook_submit() in modules. However, Coder is falsely recognizing any _submit() functions as a hook_submit, thereby causing havoc in the form definition substitutions as well as function calls to the same.
Comment #2
douggreen commentedThis is a 3 year old bug report. Coder isn't actually doing the replacement (unless @girishmuraly is talking about coder_update), it's just falsely recognizing a hook_submit. If we had a better example, it's possible that we could figure out an exclusion for this hook_submit.
But in general, it is often a good idea to not name your functions with hook names. For example, if you had a module named foo.module and you had foo_thisisnot_submit as a generic function name, AND someone else wrote a module named foo_thisisnot.module, then your function would be called as a submit handler. It's best to just not name things this way.