diff --git a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php
index f7e0690..f7d9eaa 100644
--- a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php
+++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php
@@ -373,6 +373,9 @@ function testMenuQueryAndFragment() {
     $path = 'test-page?arg1=value1&arg2=value2';
     $item = $this->addMenuLink(0, $path);
 
+    $this->drupalGet('admin/structure/menu/manage/' . $item['menu_name']);
+    $this->assertLinkByHref($path, 0, 'Path with query and fragment generated.');
+    
     $this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
     $this->assertFieldByName('link_path', $path, 'Path is found with both query and fragment.');
 
diff --git a/core/modules/menu/lib/Drupal/menu/Tests/MenuWebTestBase.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuWebTestBase.php
index e1c21a0..392e6f2 100644
--- a/core/modules/menu/lib/Drupal/menu/Tests/MenuWebTestBase.php
+++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuWebTestBase.php
@@ -8,6 +8,7 @@
 namespace Drupal\menu\Tests;
 
 use Drupal\simpletest\WebTestBase;
+use Drupal\Component\Utility\Url;
 
 /**
  * Defines a base class for menu web tests.
@@ -34,7 +35,7 @@ function assertMenuLink($mlid, array $expected_item) {
     $item = entity_load('menu_link', $mlid);
     $options = $item->options;
     if (!empty($options['query'])) {
-      $item['link_path'] .= '?' . \Drupal::urlGenerator()->httpBuildQuery($options['query']);
+      $item['link_path'] .= '?' . Url::buildQuery($options['query']);
     }
     if (!empty($options['fragment'])) {
       $item['link_path'] .= '#' . $options['fragment'];
diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php
index 8aea21d..7fb41f2 100644
--- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php
+++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php
@@ -13,6 +13,7 @@
 use Drupal\Core\Routing\UrlGenerator;
 use Drupal\menu_link\MenuLinkStorageControllerInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Component\Utility\Url;
 
 /**
  * Form controller for the node edit forms.
@@ -104,7 +105,7 @@ public function form(array $form, array &$form_state) {
     // $base_path.
     $path = $menu_link->link_path;
     if (isset($menu_link->options['query'])) {
-      $path .= '?' . $this->urlGenerator->httpBuildQuery($menu_link->options['query']);
+      $path .= '?' . Url::buildQuery($menu_link->options['query']);
     }
     if (isset($menu_link->options['fragment'])) {
       $path .= '#' . $menu_link->options['fragment'];
@@ -228,20 +229,26 @@ public function validate(array $form, array &$form_state) {
       if (isset($parsed_link['query'])) {
         $menu_link->options['query'] = array();
         parse_str($parsed_link['query'], $menu_link->options['query']);
+        $form_state['values']['options']['query'] = $menu_link->options['query'];
       }
       else {
+	// Use unset() to remove query parameters.
+	unset($form_state['values']['options']['query']);
         // Use unset() rather than setting to empty string
         // to avoid redundant serialized data being stored.
         unset($menu_link->options['query']);
       }
       if (isset($parsed_link['fragment'])) {
-        $menu_link->options['fragment'] = $parsed_link['fragment'];
+        //$menu_link->options['fragment'] = $parsed_link['fragment'];
+	$form_state['values']['options']['fragment'] = $menu_link->options['fragment'] = $parsed_link['fragment'];
       }
       else {
+	unset($form_state['values']['options']['fragment']);
         unset($menu_link->options['fragment']);
       }
       if (isset($parsed_link['path']) && $menu_link->link_path != $parsed_link['path']) {
-        $menu_link->link_path = $parsed_link['path'];
+        //$menu_link->link_path = $parsed_link['path'];
+	$form_state['values']['link_path'] = $menu_link->link_path = $parsed_link['path'];
       }
     }
     if (!trim($menu_link->link_path) || !drupal_valid_path($menu_link->link_path, TRUE)) {
@@ -258,6 +265,11 @@ public function submit(array $form, array &$form_state) {
     // Build the menu link object from the submitted values.
     $menu_link = parent::submit($form, $form_state);
 
+    // Remove query parameters if no parameters when validating.
+    if (!isset($form_state['values']['options']['query']) && isset($menu_link->options['query'])) {
+      unset($menu_link->options['query']);
+    }
+
     // The value of "hidden" is the opposite of the value supplied by the
     // "enabled" checkbox.
     $menu_link->hidden = (int) !$menu_link->enabled;
