API page: http://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_g...

Enter a descriptive title (above) relating to drupal_goto, then describe the problem you have found:

This function allows $path to be empty, but doesn't say what will happen if you do that. I *assume* you go to the front page...?

#9 1596598-9-drupal_goto-docs.patch2.55 KBmr.baileys
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es). View
#5 1596598-5-drupal_goto-docs.patch2.28 KBmr.baileys
PASSED: [[SimpleTest]]: [MySQL] 36,891 pass(es). View
#3 1596598-3-drupal_goto-docs.patch2.45 KBmr.baileys
PASSED: [[SimpleTest]]: [MySQL] 36,884 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


joachim’s picture


jhodgdon’s picture

It looks like we should probably say on $path ", which will be passed to url() to compute the redirect for the URL.", and we should add something to url() that says that '' is equivalent to '<front>' (which you can tell from reading the code, but it should be in the documentation).

The reason I suggest this is that is that there is a lot of documentation already on url() that I don't think we want to duplicate. Better just to refer to reader there.

mr.baileys’s picture

Status: Active » Needs review
2.45 KB
PASSED: [[SimpleTest]]: [MySQL] 36,884 pass(es). View
  • Implemented the suggestion from #2.
  • Additionally, I've added "(optional)" to all optional parameters in drupal_goto() and url(), and an extra sentence and default for the $http_response_code in url().
jhodgdon’s picture

Status: Needs review » Needs work

That looks really good! Tow small things I think should be fixed:


  *   @link http://tools.ietf.org/html/draft-reschke-http-status-308-07 draft for the new HTTP status codes: @endlink
+ *   Defaults to 302.
(list comes next)

This will end up reading as:

(link)...status codes: (endlink) Defaults to 302.
- list item

That isn't good. The : needs to be at the end of the line before the list, so the "Defaults to 302." should go somewhere else.


+ *   "node/34" or "http://example.com/foo". The default value is equivalent to
+ *   passing '<front>'. A few notes:

passing -> passing in

mr.baileys’s picture

2.28 KB
PASSED: [[SimpleTest]]: [MySQL] 36,891 pass(es). View

Can't believe I missed the ':'+list. Would this work:

The HTTP status code to use for the redirection, defaults to 302. The valid values for 3xx redirection status codes are defined in...

mr.baileys’s picture

Status: Needs work » Needs review

status change

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

That looks perfect, thanks! I'll get it committed shortly.

jhodgdon’s picture

Version: 8.x-dev » 6.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 8.x. The patch also applied to 7.x with a small amount of fuzz, so I committed it there too. Thanks!

I think we should probably backport it to 6.x as well, since I think it is all correct there (might be a good idea to verify this).

mr.baileys’s picture

Status: Patch (to be ported) » Needs review
Issue tags: -needs backport to D7
2.55 KB
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es). View

Back-ported to D6, verified that the logic is the same (i.e. passing NULL or '' to url is equivalent to pointing to the home page).

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

That looks good for 6.x -- thanks!

jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

I've been given permission to commit docs patches for Drupal 6, so this is in! Thanks again!

Automatically closed -- issue fixed for 2 weeks with no activity.