Permalink
Browse files

Merge branch 'wip-MDL-26044' of git://github.com/sammarshallou/moodle

  • Loading branch information...
2 parents 912d099 + 27d6ab5 commit 21c91e2e11f2ef9e2c5fa22a8e4a8e5521625fd5 @stronk7 stronk7 committed Jan 24, 2011
Showing with 12 additions and 6 deletions.
  1. +12 −6 lib/weblib.php
View
@@ -389,11 +389,13 @@ public function params(array $params = null) {
if (is_int($key)) {
throw new coding_exception('Url parameters can not have numeric keys!');
}
- if (is_array($value)) {
- throw new coding_exception('Url parameters values can not be arrays!');
- }
- if (is_object($value) and !method_exists($value, '__toString')) {
- throw new coding_exception('Url parameters values can not be objects, unless __toString() is defined!');
+ if (!is_string($value)) {
+ if (is_array($value)) {
+ throw new coding_exception('Url parameters values can not be arrays!');
+ }
+ if (is_object($value) and !method_exists($value, '__toString')) {
+ throw new coding_exception('Url parameters values can not be objects, unless __toString() is defined!');
+ }
}
$this->params[$key] = (string)$value;
}
@@ -486,7 +488,11 @@ protected function merge_overrideparams(array $overrideparams = null) {
*/
public function get_query_string($escaped = true, array $overrideparams = null) {
$arr = array();
- $params = $this->merge_overrideparams($overrideparams);
+ if ($overrideparams !== null) {
+ $params = $this->merge_overrideparams($overrideparams);
+ } else {
+ $params = $this->params;
+ }
foreach ($params as $key => $val) {
$arr[] = rawurlencode($key)."=".rawurlencode($val);
}

0 comments on commit 21c91e2

Please sign in to comment.