Skip to content

Commit

Permalink
Fixes phingofficial#693 - escape file paths in patch task
Browse files Browse the repository at this point in the history
  • Loading branch information
mrook committed Mar 24, 2017
1 parent b62e159 commit 9933c07
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions classes/phing/tasks/ext/PatchTask.php
Expand Up @@ -162,7 +162,7 @@ public function setStrip($num)
throw new BuildException('strip has to be >= 0');
}

$this->strip = $num;
$this->strip = (integer) $num;
}

/**
Expand Down Expand Up @@ -260,14 +260,14 @@ public function main()
}

// Define patch file
$this->cmdArgs [] = '-i ' . $this->patchFile;
$this->cmdArgs [] = '-i ' . escapeshellarg($this->patchFile);
// Define strip factor
if ($this->strip != null) {
$this->cmdArgs [] = '--strip=' . $this->strip;
}
// Define original file if specified
if ($this->originalFile != null) {
$this->cmdArgs [] = $this->originalFile;
$this->cmdArgs [] = escapeshellarg($this->originalFile);
}

$cmd = self::CMD . implode(' ', $this->cmdArgs);
Expand Down

0 comments on commit 9933c07

Please sign in to comment.