sebastianbergmann/php-code-coverage — Issue #72: Warning in Render HTML
Author: joskfg
Created: 2011-10-13 17:27:40+00:00
State: open

When I run phpunit it show:

[exec] PHP Warning: Invalid argument supplied for foreach() in /usr/share/pear/PHP/CodeCoverage/Report/HTML/Renderer/File.php on line 354
[exec] PHP Stack trace:
[exec] PHP 1. {main}() /usr/bin/phpunit:0
[exec] PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
[exec] PHP 3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:125
[exec] PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/pear/PHPUnit/TextUI/Command.php:187
[exec] PHP 5. PHP_CodeCoverage_Report_HTML->process() /usr/share/pear/PHPUnit/TextUI/TestRunner.php:354
[exec] PHP 6. PHP_CodeCoverage_Report_HTML_Renderer_File->render() /usr/share/pear/PHP/CodeCoverage/Report/HTML.php:180
[exec] PHP 7. PHP_CodeCoverage_Report_HTML_Renderer_File->renderSource() /usr/share/pear/PHP/CodeCoverage/Report/HTML/Renderer/File.php:124

The function spects fileLoad return an array with two elements, but it returns only one.

I have resolved this issue with this patch:

diff /usr/share/pear/PHP/CodeCoverage/Report/HTML/Renderer/File.php ./File.php
493c493
< return $lines;
---
> return array($lines, $fillup);

I dont' know if this is correct, but works for me.