Skip to content

Commit

Permalink
Specifying a path to a non-existent dir when using the --report-[repo…
Browse files Browse the repository at this point in the history
…rtType]=/path/to/report CLI option no longer throws an exception (ref #1992)
  • Loading branch information
gsherwood committed Apr 17, 2018
1 parent d02b37c commit 35ca0c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
-- A new "Closure opening brace placement" metric now shows information for closures
- Multi-line T_YIELD_FROM statemenets are now replicated properly for older PHP versions
- The PSR2 standard no longer produces 2 error messages when the AS keyword in a foreach loop is not lowercase
- Specifying a path to a non-existent dir when using the --report-[reportType]=/path/to/report CLI option no longer throws an exception
-- This now prints a readable error message, as it does when using --report-file
- Removed Squiz.PHP.DisallowObEndFlush from the Squiz standard
-- If you use this sniff and want to continue banning ob_end_flush(), use Generic.PHP.ForbiddenFunctions instead
-- You will need to set the forbiddenFunctions property in your ruleset.xml file
Expand Down
6 changes: 6 additions & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,12 @@ public function processLongArgument($arg, $pos)
$output = null;
} else {
$dir = dirname($output);
if (is_dir($dir) === false) {
$error = 'ERROR: The specified '.$report.' report file path "'.$output.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
$error .= $this->printShortUsage(true);
throw new DeepExitException($error, 3);
}

if ($dir === '.') {
// Passed report file is a filename in the current directory.
$output = getcwd().'/'.basename($output);
Expand Down

0 comments on commit 35ca0c9

Please # to comment.