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...?

Files: 
CommentFileSizeAuthor
#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 ]

Comments

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.

Status:Active» Needs review
StatusFileSize
new2.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().

Status:Needs review» Needs work

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

a)

  *   @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.

b)

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

passing -> passing in

StatusFileSize
new2.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...

Status:Needs work» Needs review

status change

Status:Needs review» Reviewed & tested by the community

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

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).

Status:Patch (to be ported)» Needs review
Issue tags:-needs backport to D7
StatusFileSize
new2.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).

Status:Needs review» Reviewed & tested by the community

That looks good for 6.x -- thanks!

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.