Skip to content

Commit

Permalink
Call vsprintf correctly in ChmodTask (#1627)
Browse files Browse the repository at this point in the history
`vsprint` expects its second argument to be an array. Old PHP versions silently also accepted a single non-array parameter that was "upgraded" to [$param].
This becomes an issue on PHP8, because it type-checks the parameter and issues an error accordingly.

This issue is already fixed in `main` and only exists in `oldstable`.
  • Loading branch information
bzikarsky authored Aug 27, 2021
1 parent e2dd899 commit 4b92e8b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions classes/phing/tasks/system/ChmodTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ private function chmod()
}

if (!$this->verbose) {
$this->log('Total files changed to ' . vsprintf('%o', $mode) . ': ' . $total_files);
$this->log('Total directories changed to ' . vsprintf('%o', $mode) . ': ' . $total_dirs);
$this->log('Total files changed to ' . vsprintf('%o', [$mode]) . ': ' . $total_files);
$this->log('Total directories changed to ' . vsprintf('%o', [$mode]) . ': ' . $total_dirs);
}

}
Expand All @@ -210,7 +210,7 @@ private function chmodFile(PhingFile $file, $mode)
try {
$file->setMode($mode);
if ($this->verbose) {
$this->log("Changed file mode on '" . $file->__toString() . "' to " . vsprintf("%o", $mode));
$this->log("Changed file mode on '" . $file->__toString() . "' to " . vsprintf("%o", [$mode]));
}
} catch (Exception $e) {
if ($this->failonerror) {
Expand Down

0 comments on commit 4b92e8b

Please sign in to comment.