I reported it as a bug* that a module was using drupal_goto to redirect the user to an external URL because another module that implemented hook_alter_drupal_goto was expecting only internal paths. I had originally thought the latter was at fault until I read the manual for drupal_goto:
Sends the user to a different Drupal page.
This issues an on-site HTTP redirect.
drupal_goto does work fine for external URLs so long as any modules implementing hook_alter_drupal_goto correctly handle it, so if that is expected use I think the documentation should make it clearer, e.g.
Sends the user to a different Drupal page or external URL.
This issues an HTTP redirect.
Comment | File | Size | Author |
---|---|---|---|
#2 | core-2038629-correct-drupal-goto-documentation-2.patch | 408 bytes | sambonner |
Comments
Comment #1
jhodgdonJudging by the comments on the related issue, it does sound like we should change the documentation for drupal_goto().
Actually, the documentation for the first parameter in drupal_goto() in D7 says this:
And the documentation for hook_drupal_goto_alter() also already says:
So it is just the first line of drupal_goto() that is incorrect. This is a 7.x issue only; the function has been removed in Drupal 8:
https://drupal.org/node/2023537
Sounds like a good Novice issue to fix the first line of drupal_goto() documentation...
Comment #2
sambonner CreditAttribution: sambonner commentedAttaching a patch that corrects this error.
Comment #3
jhodgdonShort and sweet, thanks! I'll get this committed shortly.
Comment #4
jhodgdonThanks again! Committed to 7.x.