Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
API page: http://api.drupal.org/api/drupal/core%21modules%21search%21search.pages....
The code executed from the function (at the end of the function) is the following one.
$form_state['redirect'] = $form_state['action'] . '/' . $keys;
return;
The return
statement is useless, as the function is already returning to the caller.
Comment | File | Size | Author |
---|---|---|---|
#8 | d6-remove-return-statement-from-search_form_submit-function-1817484-8.patch | 418 bytes | tomgeekery |
#2 | remove-return-statement-from-search_form_submit-function-1817484-2.patch | 363 bytes | tomgeekery |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #2
tomgeekery CreditAttribution: tomgeekery commentedI am attaching a patch that removes the return statement from the search_form_submit function in search.pages.inc. Should this be back ported to D7 as well?
Comment #3
BerdirMakes sense to clean this up, if this code exists in 7.x too, then it could be backported, not *that* important, though.
Comment #4
apadernoThe code of that function has not been changed since Drupal 6. On Drupal 5, the code was the following one.
In Drupal 6, the function uses
$form_state['redirect'] = 'search/' . $type . '/' . $keys;
but leaves thereturn
statement which doesn't return anything.Comment #5
webchickCommitted and pushed to 8.x and 7.x. Thanks!
Not sure about backporting such clean-up patches all the way to 6.x, but I'll move it there for porting.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #7
apadernoI am not sure there is the need of changing the code for Drupal 6; it is not a bug, and leaving that statement doesn't have any bad consequences, especially because it's the last statement in the function.
Comment #8
tomgeekery CreditAttribution: tomgeekery commentedI am attaching a patch for D6. I am still pretty new at writing patches so thank you for the practice!
Comment #9
jhodgdonThanks for the backport! At this point I do not think we are committing anything except vital bug fixes to Drupal 6... and we had a gap where no one was maintaining the search module so your patch didn't get noticed back when it might have gotten committed. Sorry about that!
Comment #10
jhodgdonActually, I was wrong. there is a chance this could be committed, as it's an obvious cleanup and will definitely not cause any problems to commit it. So I'll mark it as RTBC and we can see what happens.
Comment #12
jhodgdontest bot glitch!
Comment #13
jhodgdon8: d6-remove-return-statement-from-search_form_submit-function-1817484-8.patch queued for re-testing.
Comment #16
jhodgdonComment #18
jhodgdonThese errors are unrelated to the patch, but I'm not going to click "retest" any more...
Comment #19
jhodgdonTalked with Gabor (the Drupal 6 branch maintainer) and D6 issues are really not being committed unless they're really essential -- we really don't have a test system for Drupal 6 and it's too dangerous. So... putting this back to D7 / fixed, even though this is a simple one-line patch.