Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.2

Bug #20252 Unitialized string offset when package name starts with underscore
Submitted: 2014-04-25 01:06 UTC
From: etki Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.5.2)
PHP Version: 5.5.3 OS: lubuntu 13.10
Roadmaps: (Not assigned)    
Subscription  


 [2014-04-25 01:06 UTC] etki (Fike Etki)
Description: ------------ Hi. I constantly get following error while analyzing different files: PHP Notice: Uninitialized string offset: 0 in /home/fike/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Stan dards/PEAR/Sniffs/Commenting/FileCommentSniff.php on line 606 I can confirm that it happens when @package tag starts with underscore, however, i think i've encountered this in different scenarios. The minimal scenario that triggers error is pasted below. Test script: --------------- <?php /** * @package _helpers */ class MigrationHelper { } Actual result: -------------- Backtrace: PHP Notice: Uninitialized string offset: 0 in /home/fike/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Stan dards/PEAR/Sniffs/Commenting/FileCommentSniff.php on line 606 PHP Stack trace: PHP 1. {main}() /home/fike/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcs:0 PHP 2. PHP_CodeSniffer_CLI->process() /home/fike/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcs:37 PHP 3. PHP_CodeSniffer->process() /home/fike/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI. php:614 PHP 4. PHP_CodeSniffer->processFile() /home/fike/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php: 488 PHP 5. PHP_CodeSniffer->_processFile() /home/fike/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php: 1340 PHP 6. PHP_CodeSniffer_File->start() /home/fike/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php: 1460 PHP 7. PEAR_Sniffs_Commenting_ClassCommentSniff->process() /home/fike/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/File. php:506 PHP 8. PEAR_Sniffs_Commenting_FileCommentSniff->processTags() /home/fike/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Stan dards/PEAR/Sniffs/Commenting/ClassCommentSniff.php:200 PHP 9. call_user_func() /home/fike/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Stan dards/PEAR/Sniffs/Commenting/FileCommentSniff.php:461 PHP 10. PEAR_Sniffs_Commenting_FileCommentSniff- >processPackage() /home/fike/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Stan dards/PEAR/Sniffs/Commenting/FileCommentSniff.php:461

Comments

 [2014-04-29 07:50 UTC] squiz (Greg Sherwood)
-Summary: Unitialized string offset +Summary: Unitialized string offset when package name starts with underscore -Assigned To: +Assigned To: squiz
 [2014-04-29 07:52 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Fixed in github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/82ae9ff7630b30ecf5958bcf894 ddac0b5701ffa