sebastianbergmann/phpunit — Issue #397: Getting undefined offset when generate coverage report
Author: jrbasso
Created: 2011-11-05 21:08:15+00:00
State: open

Using PHPUnit 3.6.2 I am getting an undefined offset when generate coverage report.

```
$ phpunit -c phpunit.xml UserTest.php
PHPUnit 3.6.2 by Sebastian Bergmann.

Configuration read from /.../Test/phpunit.xml

..

Time: 8 seconds, Memory: 8.25Mb

OK (2 tests, 25 assertions)

Generating code coverage report, this may take a moment.PHP Notice: Undefined offset: 17 in /usr/local/lib/php/PHP/Token/Stream.php on line 534
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/local/lib/php/PHPUnit/TextUI/Command.php:126
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/local/lib/php/PHPUnit/TextUI/Command.php:188
PHP 5. PHP_CodeCoverage_Report_HTML->process() /usr/local/lib/php/PHPUnit/TextUI/TestRunner.php:368
PHP 6. PHP_CodeCoverage->getReport() /usr/local/lib/php/PHP/CodeCoverage/Report/HTML.php:133
PHP 7. PHP_CodeCoverage_Report_Factory->create() /usr/local/lib/php/PHP/CodeCoverage.php:141
PHP 8. PHP_CodeCoverage_Report_Factory->addItems() /usr/local/lib/php/PHP/CodeCoverage/Report/Factory.php:76
PHP 9. PHP_CodeCoverage_Report_Factory->addItems() /usr/local/lib/php/PHP/CodeCoverage/Report/Factory.php:95
PHP 10. PHP_CodeCoverage_Report_Node_Directory->addFile() /usr/local/lib/php/PHP/CodeCoverage/Report/Factory.php:92
PHP 11. PHP_CodeCoverage_Report_Node_File->__construct() /usr/local/lib/php/PHP/CodeCoverage/Report/Node/Directory.php:211
PHP 12. PHP_CodeCoverage_Util::getLinesToBeIgnored() /usr/local/lib/php/PHP/CodeCoverage/Report/Node/File.php:166
PHP 13. PHP_Token_Stream->getClasses() /usr/local/lib/php/PHP/CodeCoverage/Util.php:259
PHP 14. PHP_Token_Stream->parse() /usr/local/lib/php/PHP/Token/Stream.php:249
PHP 15. PHP_Token_INTERFACE->getInterfaces() /usr/local/lib/php/PHP/Token/Stream.php:396
PHP 16. PHP_Token_INTERFACE->hasInterfaces() /usr/local/lib/php/PHP/Token.php:591
PHP 17. PHP_Token_Stream->offsetGet() /usr/local/lib/php/PHP/Token/Stream.php:582
```

phpunit.xml:

```xml

./

../Service/Test

../../lib/
./
../Service/Test
../AutoLoader.php

```

The same file wasn't causing this notice in PHPUnit 3.5.15.