Allow empty parameter values
authorChristian Weiske <cweiske@cweiske.de>
Wed, 29 Jun 2016 19:31:21 +0000 (21:31 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 29 Jun 2016 19:31:21 +0000 (21:31 +0200)
src/phancap/Options.php

index 061230cf5f0b533e244dec0f3e1a061f61ae7e1d..d39af73218fafc31009f53db328a9f865ec33622 100644 (file)
@@ -144,7 +144,11 @@ class Options
                 continue;
             }
 
-            if ($arOption['type'] == 'url') {
+            if ($arValues[$name] === ''
+                && !isset($arOption['required'])
+            ) {
+                //allow empty value; default value will be used
+            } else if ($arOption['type'] == 'url') {
                 $this->values[$name] = $this->validateUrl($arValues[$name]);
             } else if ($arOption['type'] == 'int') {
                 $this->values[$name] = $this->validateInt(