+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016 |
+ | Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
*/
/**
$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) {
+ if (isset($method[$name])) {
+ return $method[$name];
+ }
+ // 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];
+ if (isset($method[$name])) {
+ return $method[$name];
+ }
+ else {
+ continue;
+ }
+ }
+ }
+ return NULL;
+ }
+
/**
* This is a replacement for $_REQUEST which includes $_GET/$_POST
* but excludes $_COOKIE / $_ENV / $_SERVER.