diff --git a/ChangeLog-10.1.md b/ChangeLog-10.1.md index 1ee33f1db..1d82641cc 100644 --- a/ChangeLog-10.1.md +++ b/ChangeLog-10.1.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 ## [10.1.2] - 2023-05-22 diff --git a/src/Report/Clover.php b/src/Report/Clover.php index 7f9084d71..f7b75aac0 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 4ae44b65b..807735cdb 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 59a8f712e..2416b6dca 100644 --- a/src/Report/Crap4j.php +++ b/src/Report/Crap4j.php @@ -121,7 +121,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);