diff --git a/core/includes/common.inc b/core/includes/common.inc
index 0842201..a105347 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -480,24 +480,25 @@ function drupal_get_query_array($query) {
  */
 function drupal_http_build_query(array $query, $parent = '') {
   $params = array();
-
+  
   foreach ($query as $key => $value) {
     $key = ($parent ? $parent . '[' . rawurlencode($key) . ']' : rawurlencode($key));
-
+  
     // Recurse into children.
     if (is_array($value)) {
-      $params[] = drupal_http_build_query($value, $key);
-    }
-    // If a query parameter value is NULL, only append its key.
-    elseif (!isset($value)) {
-      $params[] = $key;
+      $children_query = drupal_http_build_query($value, $key);
+      if ($children_query !== '') {
+        $params[] = $children_query;
+      }
     }
     else {
       // For better readability of paths in query strings, we decode slashes.
-      $params[] = $key . '=' . str_replace('%2F', '/', rawurlencode($value));
+      if (isset($value)) {
+        $params[] = $key . '=' . str_replace('%2F', '/', rawurlencode($value));
+      }
     }
   }
-
+  
   return implode('&', $params);
 }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/GotoTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/GotoTest.php
index f1c4fbe..e1d76ce 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/GotoTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/GotoTest.php
@@ -76,8 +76,8 @@ class GotoTest extends WebTestBase {
     $this->assertText('The destination: ' . $query, t('The given query string destination is determined as destination.'));
 
     // Verify that the current path is used as destination.
-    $this->drupalGet('common-test/destination', array('query' => array($query => NULL)));
-    $url = 'common-test/destination?' . $query;
+    $this->drupalGet('common-test/destination', array('query' => array('additional_argument' => $query)));
+    $url = 'common-test/destination?additional_argument=' . $query;
     $this->assertText('The destination: ' . $url, t('The current path is determined as destination.'));
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
index 131ce25..29b7682 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
@@ -101,6 +101,16 @@ class UrlTest extends WebTestBase {
     $this->assertEqual(drupal_http_build_query(array(' &#//+%20@۞' => 'a')), '%20%26%23%2F%2F%2B%2520%40%DB%9E=a', t('Key was properly encoded.'));
     $this->assertEqual(drupal_http_build_query(array('a' => '1', 'b' => '2', 'c' => '3')), 'a=1&b=2&c=3', t('Multiple values were properly concatenated.'));
     $this->assertEqual(drupal_http_build_query(array('a' => array('b' => '2', 'c' => '3'), 'd' => 'foo')), 'a[b]=2&a[c]=3&d=foo', t('Nested array was properly encoded.'));
+    $query = array(
+      'a' => '1',
+      'b' => array(
+        'c' => array(),
+      ),
+      'd' => NULL,
+      'e' => '',
+      'f' => '2',
+    );
+    $this->assertEqual(drupal_http_build_query($query), 'a=1&e=&f=2', 'Empty query parameter values are properly ignored.');
   }
 
   /**
@@ -163,7 +173,11 @@ class UrlTest extends WebTestBase {
         $result = url('node/123', array('fragment' => 'foo', 'absolute' => $absolute));
         $this->assertEqual($url, $result, "$url == $result");
 
-        $url = $base . 'node/123?foo';
+        $url = $base . 'node/123?foo=';
+        $result = url('node/123', array('query' => array('foo' => ''), 'absolute' => $absolute));
+        $this->assertEqual($url, $result, "$url == $result");
+
+        $url = $base . 'node/123?';
         $result = url('node/123', array('query' => array('foo' => NULL), 'absolute' => $absolute));
         $this->assertEqual($url, $result, "$url == $result");
 
@@ -171,7 +185,11 @@ class UrlTest extends WebTestBase {
         $result = url('node/123', array('query' => array('foo' => 'bar', 'bar' => 'baz'), 'absolute' => $absolute));
         $this->assertEqual($url, $result, "$url == $result");
 
-        $url = $base . 'node/123?foo#bar';
+        $url = $base . 'node/123?foo=#bar';
+        $result = url('node/123', array('query' => array('foo' => ''), 'fragment' => 'bar', 'absolute' => $absolute));
+        $this->assertEqual($url, $result, "$url == $result");
+
+        $url = $base . 'node/123?#bar';
         $result = url('node/123', array('query' => array('foo' => NULL), 'fragment' => 'bar', 'absolute' => $absolute));
         $this->assertEqual($url, $result, "$url == $result");
 
