Handle space after "-x" option.
authorChristian Weiske <cweiske@cweiske.de>
Thu, 1 Feb 2018 10:12:31 +0000 (11:12 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 1 Feb 2018 10:12:31 +0000 (11:12 +0100)
Normally you do "-xfoo=bar", but some people try to do "-x foo=bar"
which caused strange issues.

Resolves: https://github.com/cweiske/shpub/issues/11

src/shpub/Command/AbstractProps.php

index e186819..c893eef 100644 (file)
@@ -188,6 +188,10 @@ class Command_AbstractProps
         if (count($cmdRes->options['x'])) {
             $postParams = [];
             foreach ($cmdRes->options['x'] as $xproperty) {
+                if ($xproperty == '') {
+                    //happens with "-x foo=bar" instead of "-xfoo=bar"
+                    continue;
+                }
                 list($propkey, $propval) = explode('=', $xproperty, 2);
                 if (!isset($postParams[$propkey])) {
                     $postParams[$propkey] = [];