diff --git a/includes/common.inc b/includes/common.inc index 9a56dd7598108428364e88d3e3e166c71307d6ed..ac500e2c37b6a17231a4f06a3633b9ed8a64f5af 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -204,11 +204,12 @@ function drupal_query_string_encode($query, $exclude = array(), $parent = '') { * @see drupal_goto() */ function drupal_get_destination() { - if ($_REQUEST['destination']) { + if (isset($_REQUEST['destination'])) { return 'destination='. urlencode($_REQUEST['destination']); } else { - $path = $_GET['q']; + // Use $_REQUEST here to retrieve the original path. + $path = isset($_REQUEST['q']) ? $_REQUEST['q'] : ''; $query = drupal_query_string_encode($_GET, array('q')); if ($query != '') { $path .= '?'. $query; @@ -994,7 +995,7 @@ function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) { $base = ($absolute ? $base_url . '/' : base_path()); // The special path '' links to the default front page. - if (isset($path) && $path != '') { + if (!empty($path) && $path != '') { $path = drupal_get_path_alias($path); $path = drupal_urlencode($path); if (!$clean_url) {