API page: http://api.drupal.org/api/drupal/includes%21menu.inc/function/menu_get_i...

Based on the following code, the function can return false.

if ($map === FALSE) {
  $router_items[$path] = FALSE;
   return FALSE;
}

Return value

The router item, an associate array corresponding to one row in the menu_router table.

Should be something like:

The router item, an associate array corresponding to one row in the menu_router table, or FALSE.

Files: 
CommentFileSizeAuthor
#9 drupal-menu-get-item-docs-1802760-9-d8.patch1.84 KBmkadin
PASSED: [[SimpleTest]]: [MySQL] 42,092 pass(es).
[ View ]
#7 drupal-menu-get-item-docs-1802760-7-d8.patch1.49 KBmkadin
PASSED: [[SimpleTest]]: [MySQL] 42,062 pass(es).
[ View ]
#4 drupal-menu-get-item-docs-1802760-4-d7.patch1.54 KBmkadin
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-menu-get-item-docs-1802760-4-d7.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#2 drupal-menu-get-item-docs-1802760-2-d8.patch1.56 KBmkadin
PASSED: [[SimpleTest]]: [MySQL] 42,097 pass(es).
[ View ]

Comments

Title:Function can return falseDocument that menu_get_item() can return false
Version:7.x-dev» 8.x-dev
Issue tags:+Novice, +needs backport to D7

Thanks for noticing and reporting this! The documentation of the return value should indicate under what conditions FALSE can be returned.

StatusFileSize
new1.56 KB
PASSED: [[SimpleTest]]: [MySQL] 42,097 pass(es).
[ View ]

Here you go. Didn't want to repeat the explanation from _menu_translate() docs.

Did a little English work in the _menu_translate() docs as well.

D7 backport coming shortly.

Status:Active» Needs review

StatusFileSize
new1.54 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-menu-get-item-docs-1802760-4-d7.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

D7 patch as well.

Status:Needs review» Needs work

The last submitted patch, drupal-menu-get-item-docs-1802760-4-d7.patch, failed testing.

Please read http://drupal.org/node/1319154#multiple-versions regarding uploading D7 patches too soon (however, thanks for the patches!).

Regarding the d8 patch, I think we need to go back up one line and fix one thing:

*   The router item, an associate array corresponding to one row in the

associate -> associative

Also, the whole thing ... well it still seemed a bit confusing to me. With this patch, the @return reads:

The router item, an associate array corresponding to one row in the
menu_router table or FALSE. The value of key map holds the loaded objects.
The value of key access is TRUE if the current user can access this page.
The values for key title, page_arguments, access_arguments, and
theme_arguments will be filled in based on the database values and the
objects loaded. If an error occurs when objects are loaded via
_menu_translate(), FALSE will be returned.

I had a lot of trouble making sense of this paragraph -- I would suggest reworking it like this:

Either the router item or, if an error occurs, FALSE. A router item is an associative array corresponding to...

Status:Needs work» Needs review
StatusFileSize
new1.49 KB
PASSED: [[SimpleTest]]: [MySQL] 42,062 pass(es).
[ View ]

Hows this?

Status:Needs review» Needs work

Better, thanks! A few small typographical errors:
- There should be only one space after "." at ends of sentences.
- "associate array" => "associative array"
- I think it would be even easier to read if it said "The value *corresponding* to key 'map' is..." etc. (obviously, without the **).

StatusFileSize
new1.84 KB
PASSED: [[SimpleTest]]: [MySQL] 42,092 pass(es).
[ View ]

Agreed, I didn't like the way the key value pairs were describe either. Here's a shot at it.

Assigned:Unassigned» jhodgdon
Status:Needs work» Reviewed & tested by the community

I like this version much better, thanks! Provisionally RTBC (pending bot), and I'll get it committed sometime soon (probably tomorrow, I'm done with commits for today).

Assigned:jhodgdon» Unassigned
Status:Reviewed & tested by the community» Fixed

Thanks! Committed to 8.x and 7.x.

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