tests
[plcapi.git] / tests / parse_args.php
index 6660b9e..d9b3d5a 100644 (file)
@@ -14,7 +14,7 @@
  * @param int     HTTPSVERIFYHOST
  * @param int     SSLVERSION
  *
- * @copyright (C) 2007-2015 G. Giunta
+ * @copyright (C) 2007-2020 G. Giunta
  * @license code licensed under the BSD License: see file license.txt
  **/
 class argParser
@@ -36,15 +36,11 @@ class argParser
             'LOCALPATH' => __DIR__,
         );
 
-        // check for command line vs web page input params
+        // check for command line (env vars) vs. web page input params
         if (!isset($_SERVER['REQUEST_METHOD'])) {
-            if (isset($argv)) {
-                foreach ($argv as $param) {
-                    $param = explode('=', $param);
-                    if (count($param) > 1) {
-                        $pname = strtoupper(ltrim($param[0], '-'));
-                        $$pname = $param[1];
-                    }
+            foreach($_SERVER as $key => $val) {
+                if (array_key_exists($key, $args)) {
+                    $$key = $val;
                 }
             }
         } else {