Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/kohana/core
Browse files Browse the repository at this point in the history
  • Loading branch information
Woody Gilk committed Jun 6, 2010
2 parents c5419dc + 249f5aa commit 6dc4bb1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions classes/kohana/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static function site($uri = '', $protocol = FALSE)
if ($fragment = parse_url($uri, PHP_URL_FRAGMENT))
{
// #fragment
$fragment = '#'.$fragment;
$fragment = '#'.$fragment;
}

// Concat the URL
Expand All @@ -104,6 +104,8 @@ public static function site($uri = '', $protocol = FALSE)
* Typically you would use this when you are sorting query results,
* or something similar.
*
* [!!] Parameters with a NULL value are left out.
*
* @param array array of GET parameters
* @return string
*/
Expand All @@ -126,7 +128,10 @@ public static function query(array $params = NULL)
return '';
}

return '?'.http_build_query($params, '', '&');
$query = http_build_query($params, '', '&');

// Don't prepend '?' to an empty string
return ($query === '') ? '' : '?'.$query;
}

/**
Expand Down

0 comments on commit 6dc4bb1

Please sign in to comment.