-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP report does not handle serialized code coverage data larger than 2 GB #971
Comments
Does this help? diff --git a/src/Report/PHP.php b/src/Report/PHP.php
index d16b1b8..d45136c 100644
--- a/src/Report/PHP.php
+++ b/src/Report/PHP.php
@@ -21,14 +21,8 @@ final class PHP
{
public function process(CodeCoverage $coverage, ?string $target = null): string
{
- $buffer = sprintf(
- "<?php
-return \unserialize(<<<'END_OF_COVERAGE_SERIALIZATION'%s%s%sEND_OF_COVERAGE_SERIALIZATION%s);",
- PHP_EOL,
- serialize($coverage),
- PHP_EOL,
- PHP_EOL
- );
+ $buffer = "<?php
+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)); |
sebastianbergmann
changed the title
php-code-coverage/src/Report/PHP.php on line 30 sprintf receives string longer than 2G
PHP report does not handle serialized code coverage data larger than 2 GB
Dec 22, 2022
With that patch the process was successful.
Thank you for your really quick response. Would that $buffer variable still might cause the same problem in the future? |
It's not about the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generating code coverage report in PHP format ... PHP Fatal error: Field width 2251485604 is too long in /.../vendor/phpunit/php-code-coverage/src/Report/PHP.php on line 30
Fatal error: Field width 2251485604 is too long in /.../vendor/phpunit/php-code-coverage/src/Report/PHP.php on line 30
triggered with command:
this is our codebase size:
And size of tests:
The text was updated successfully, but these errors were encountered: