Fix visibility on legacy functions
[civicrm-core.git] / CRM / Utils / Request.php
index a5357f85f35e00c9b1ad7f2e4d5a5ce356e2919d..2748e07d7df8e2c16d361009ff96d2e1a6f7ae9e 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016                                |
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
  */
 
 /**
@@ -146,14 +146,22 @@ class CRM_Utils_Request {
    *    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) {
+      if (strpos($key, 'amp;') !== FALSE) {
         $method[str_replace('amp;', '', $key)] = $method[$key];
-        unset($method[$key]);
+        if (isset($method[$name])) {
+          return $method[$name];
+        }
+        else {
+          continue;
+        }
       }
     }
-    return CRM_Utils_Array::value($name, $method);
+    return NULL;
   }
 
   /**