Skip to content

Commit

Permalink
Handle NULL Values in expandOptionsManually and expandOptions Functions
Browse files Browse the repository at this point in the history
  • Loading branch information
patmr7 committed Jul 31, 2023
1 parent 031b871 commit 3c90cae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Moosh/MooshCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ public function expandOptions() {
//TODO handle %%
$current_options = array();
foreach ($this->expandedOptions as $k => $v) {
if ($v === null) {
$v = '';
}
$expanded = str_replace('%s', $arg, $v);
if ($this->verbose && $v != $expanded) {
echo "'$k' expanded from '$v' to '$expanded'\n";
Expand All @@ -271,6 +274,9 @@ public function expandOptionsManually($replacements) {
//process all options
//TODO handle %%
foreach ($this->expandedOptions as $k => $v) {
if ($v === null) {
$v = '';
}
$expanded = str_replace('%s', $arg, $v);
if ($this->verbose && $v != $expanded) {
echo "'$k' manually expanded from '$v' to '$expanded'\n";
Expand Down

0 comments on commit 3c90cae

Please sign in to comment.