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

Bug #18336 Function isUnderscoreName gives php notices
Submitted: 2011-03-04 15:27 UTC
From: ppershing Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.0RC2)
PHP Version: 5.3.1 OS: linux
Roadmaps: (Not assigned)    
Subscription  


 [2011-03-04 15:27 UTC] ppershing (Peter Peresini)
Description: ------------ In my project, there are lots of warnings like this: Notice: Uninitialized string offset: 0 in /usr/share/php/PHP/CodeSniffer.php on line 1630 The problem is apparently in if ($bit{0} !== strtoupper($bit{0})), when the $bit is empty. This may happen for example if you use double underscore in names. The fix is to check if $bit is not empty first. Test script: --------------- <?php /** * Contains wrapper for usual argument-checking in function calls. * * @package Fajr * @subpackage Libfajr__Base * @author Peter Perešíni <ppershing+fajr@gmail.com> * @filesource */ Expected result: ---------------- No warnings Actual result: -------------- Following notice with stacktrace: Notice: Uninitialized string offset: 0 in /usr/share/php/PHP/CodeSniffer.php on line 1630 Call Stack: 0.0002 644792 1. {main}() /usr/bin/phpcs:0 0.0143 2524928 2. PHP_CodeSniffer_CLI-)process() /usr/bin/phpcs:38 0.0152 2536760 3. PHP_CodeSniffer-)process() /usr/share/php/PHP/CodeSniffer/CLI.php:542 115.8153 31279208 4. PHP_CodeSniffer-)processFile() /usr/share/php/PHP/CodeSniffer.php:484 115.8155 31279784 5. PHP_CodeSniffer-)_processFile() /usr/share/php/PHP/CodeSniffer.php:1112 115.8155 31283224 6. PHP_CodeSniffer_File-)start() /usr/share/php/PHP/CodeSniffer.php:1232 116.1286 24199264 7. Fajr_Sniffs_Comment_ClassCommentSniff-)process() /usr/share/php/PHP/CodeSniffer/File.php:471 116.1319 24228192 8. Fajr_Sniffs_Comment_FileCommentSniff-)processTags() /home/ppershing/public_html/fajr_devel/scripts/phpcs/Fajr/Sn iffs/Comment/ClassCommentSniff.php:189 116.1322 24234328 9. call_user_func() /home/ppershing/public_html/fajr_devel/scripts/phpcs/Fajr/Sn iffs/Comment/FileCommentSniff.php:388 116.1322 24234384 10. Fajr_Sniffs_Comment_FileCommentSniff- )processSubpackage() /home/ppershing/public_html/fajr_devel/scripts/phpcs/Fajr/Sn iffs/Comment/FileCommentSniff.php:0 116.1322 24234384 11. PHP_CodeSniffer::isUnderscoreName() /home/ppershing/public_html/fajr_devel/scripts/phpcs/Fajr/Sn iffs/Comment/FileCommentSniff.php:529

Comments

 [2011-03-07 03:57 UTC] squiz (Greg Sherwood)
-Summary: function isUnderscoreName gives php notices +Summary: Function isUnderscoreName gives php notices -Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.