diff --git a/ChangeLog-9.2.md b/ChangeLog-9.2.md index bcee18213..e6747c439 100644 --- a/ChangeLog-9.2.md +++ b/ChangeLog-9.2.md @@ -11,6 +11,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt ### Fixed * Static analysis cache keys do not include configuration settings that affect source code parsing +* The Clover, Cobertura, Crap4j, and PHP report writers no longer create a `php:` directory when they should write to `php://stdout`, for instance ## [9.2.26] - 2023-03-06 diff --git a/src/Report/Clover.php b/src/Report/Clover.php index 75c731bbe..fa8dbcd00 100644 --- a/src/Report/Clover.php +++ b/src/Report/Clover.php @@ -243,7 +243,9 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string $buffer = $xmlDocument->saveXML(); if ($target !== null) { - Filesystem::createDirectory(dirname($target)); + if (!strpos($target, '://') !== false) { + Filesystem::createDirectory(dirname($target)); + } if (@file_put_contents($target, $buffer) === false) { throw new WriteOperationFailedException($target); diff --git a/src/Report/Cobertura.php b/src/Report/Cobertura.php index 0d1dde760..171064cd1 100644 --- a/src/Report/Cobertura.php +++ b/src/Report/Cobertura.php @@ -294,7 +294,9 @@ public function process(CodeCoverage $coverage, ?string $target = null): string $buffer = $document->saveXML(); if ($target !== null) { - Filesystem::createDirectory(dirname($target)); + if (!strpos($target, '://') !== false) { + Filesystem::createDirectory(dirname($target)); + } if (@file_put_contents($target, $buffer) === false) { throw new WriteOperationFailedException($target); diff --git a/src/Report/Crap4j.php b/src/Report/Crap4j.php index 91f8ed59d..75687e9fc 100644 --- a/src/Report/Crap4j.php +++ b/src/Report/Crap4j.php @@ -124,7 +124,9 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string $buffer = $document->saveXML(); if ($target !== null) { - Filesystem::createDirectory(dirname($target)); + if (!strpos($target, '://') !== false) { + Filesystem::createDirectory(dirname($target)); + } if (@file_put_contents($target, $buffer) === false) { throw new WriteOperationFailedException($target); diff --git a/src/Report/PHP.php b/src/Report/PHP.php index ccb104ce5..3ec388536 100644 --- a/src/Report/PHP.php +++ b/src/Report/PHP.php @@ -24,7 +24,9 @@ public function process(CodeCoverage $coverage, ?string $target = null): string return \unserialize(<<<'END_OF_COVERAGE_SERIALIZATION'" . PHP_EOL . serialize($coverage) . PHP_EOL . 'END_OF_COVERAGE_SERIALIZATION' . PHP_EOL . ');'; if ($target !== null) { - Filesystem::createDirectory(dirname($target)); + if (!strpos($target, '://') !== false) { + Filesystem::createDirectory(dirname($target)); + } if (@file_put_contents($target, $buffer) === false) { throw new WriteOperationFailedException($target);