 .../lib/Drupal/system/Tests/Menu/RouterTest.php    |  9 +++++++++
 .../tests/modules/menu_test/menu_test.module       | 22 +++++++++++++++++++---
 5 Dateien geändert, 50 Zeilen hinzugefügt(+), 10 Zeilen entfernt(-)

diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php
index 179ea93..0597e5f 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php
@@ -575,4 +575,13 @@ function testMenuLoadArgumentsInheritance() {
       $this->assertIdentical(unserialize($router_item['load_functions']), $load_functions, format_string('Expected load functions for router %router_path' , array('%router_path' => $router_path)));
     }
   }
+
+  /**
+   * Tests that objects are passed to menu loaders when available.
+   */
+  public function testMenuLoadArgumentObjects() {
+    $this->drupalGet('menu-test/load-argument-object/first/second');
+    // @see menu_test_other_argument_load()
+    $this->assertText('Object correctly passed to menu loader.');
+  }
 }
diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module
index 36cef57..019179e 100644
--- a/core/modules/system/tests/modules/menu_test/menu_test.module
+++ b/core/modules/system/tests/modules/menu_test/menu_test.module
@@ -363,6 +363,18 @@ function menu_test_menu() {
     'access callback' => TRUE,
   );
 
+  // Test that, when using two menu loaders, and the load arguments reference
+  // the first one, the second load function gets the loaded object passed
+  // instead of the integer index.
+  // @todo This router cannot be in the menu-test/arguments namespace because
+  //   that would already be matched by the routers above.
+  $items['menu-test/load-argument-object/%menu_test_argument/%menu_test_other_argument'] = array(
+    'title' => 'An item with menu load arguments that are objects',
+    'load arguments' => array(2),
+    'page callback' => 'menu_test_callback',
+    'access callback' => TRUE,
+  );
+
   return $items;
 }
 
@@ -370,14 +382,18 @@ function menu_test_menu() {
  * Dummy argument loader for hook_menu() to point to.
  */
 function menu_test_argument_load($arg1) {
-  return FALSE;
+  return (object) array('foo' => 'bar');
 }
 
 /**
  * Dummy argument loader for hook_menu() to point to.
  */
-function menu_test_other_argument_load($arg1) {
-  return FALSE;
+function menu_test_other_argument_load($arg1, $arg2 = NULL) {
+  if (is_object($arg2) && ($arg2->foo == 'bar')) {
+    // @todo drupal_set_message() does not work here.
+    debug('Object correctly passed to menu loader.');
+  }
+  return $arg1;
 }
 
 /**
