$value = NULL;
switch ($method) {
case 'GET':
- $value = CRM_Utils_Array::value($name, $_GET);
+ $value = self::getValue($name, $_GET);
break;
case 'POST':
- $value = CRM_Utils_Array::value($name, $_POST);
+ $value = self::getValue($name, $_POST);
break;
default:
- $value = CRM_Utils_Array::value($name, $_REQUEST);
+ $value = self::getValue($name, $_REQUEST);
break;
}
return $value;
}
+ /**
+ * @param string $name
+ * Name of the variable to be retrieved.
+ *
+ * @param array $method - '$_GET', '$_POST' or '$_REQUEST'.
+ *
+ * @return mixed
+ * The value of the variable
+ */
+ public static function getValue($name, $method) {
+ // CRM-18384 - decode incorrect keys generated when & is present in url
+ foreach ($method as $key => $value) {
+ if (strpos($key, 'amp;') !== false) {
+ $method[str_replace('amp;', '', $key)] = $method[$key];
+ unset($method[$key]);
+ }
+ }
+ return CRM_Utils_Array::value($name, $method);
+ }
+
/**
* This is a replacement for $_REQUEST which includes $_GET/$_POST
* but excludes $_COOKIE / $_ENV / $_SERVER.