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

Bug #17237 PHP Warning due to token_get_all() in UnusedFunctionParameterSniff
Submitted: 2010-03-17 04:03 UTC
From: ashnazg Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.2.2)
PHP Version: 5.2.4 OS: RHEL4
Roadmaps: (Not assigned)    
Subscription  


 [2010-03-17 04:03 UTC] ashnazg (Chuck Burgess)
Description: ------------ This is a nearly identical bug to #17236, except that a different sniff, Generic/CodeAnalysis/UnusedFunctionParameterSniff, is affected because the string is inside a function. Test script: --------------- <?php function foo() { $x = "bar = '$z', baz = '" . $a . "'..."; } ?> Expected result: ---------------- phpcs --standard=Squiz --report=summary test.php PHP CODE SNIFFER REPORT SUMMARY -------------------------------------------------------------------------- FILE ERRORS WARNINGS -------------------------------------------------------------------------- test.php 11 1 -------------------------------------------------------------------------- A TOTAL OF 11 ERROR(S) AND 1 WARNING(S) WERE FOUND IN 1 FILE(S) -------------------------------------------------------------------------- Actual result: -------------- PHP Warning: Unexpected character in input: ''' (ASCII=39) state=1 in PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php on line 115 PHP Stack trace: PHP 1. {main}() phpcs:0 PHP 2. PHP_CodeSniffer_CLI->process() phpcs:30 PHP 3. PHP_CodeSniffer->process() PHP/CodeSniffer/CLI.php:429 PHP 4. PHP_CodeSniffer->processFile() PHP/CodeSniffer.php:376 PHP 5. PHP_CodeSniffer->_processFile() PHP/CodeSniffer.php:836 PHP 6. PHP_CodeSniffer_File->start() PHP/CodeSniffer.php:921 PHP 7. Generic_Sniffs_CodeAnalysis_UnusedFunctionParameterSniff->process() PHP/CodeSniffer/File.php:431 PHP 8. token_get_all() PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php:115 Warning: Unexpected character in input: ''' (ASCII=39) state=1 in PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php on line 115 Call Stack: 0.0004 50256 1. {main}() phpcs:0 0.0187 1018560 2. PHP_CodeSniffer_CLI->process() phpcs:30 0.0193 1022920 3. PHP_CodeSniffer->process() PHP/CodeSniffer/CLI.php:429 0.1363 4577440 4. PHP_CodeSniffer->processFile() PHP/CodeSniffer.php:376 0.1365 4577808 5. PHP_CodeSniffer->_processFile() PHP/CodeSniffer.php:836 0.1365 4578620 6. PHP_CodeSniffer_File->start() PHP/CodeSniffer.php:921 0.1467 4718268 7. Generic_Sniffs_CodeAnalysis_UnusedFunctionParameterSniff->process() PHP/CodeSniffer/File.php:431 0.1469 4719772 8. token_get_all() PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php:115 PHP Warning: Unexpected character in input: ''' (ASCII=39) state=1 in PHP/CodeSniffer/Standards/Squiz/Sniffs/Strings/DoubleQuoteUsageSniff.php on line 65 PHP Stack trace: PHP 1. {main}() phpcs:0 PHP 2. PHP_CodeSniffer_CLI->process() phpcs:30 PHP 3. PHP_CodeSniffer->process() PHP/CodeSniffer/CLI.php:429 PHP 4. PHP_CodeSniffer->processFile() PHP/CodeSniffer.php:376 PHP 5. PHP_CodeSniffer->_processFile() PHP/CodeSniffer.php:836 PHP 6. PHP_CodeSniffer_File->start() PHP/CodeSniffer.php:921 PHP 7. Squiz_Sniffs_Strings_DoubleQuoteUsageSniff->process() PHP/CodeSniffer/File.php:431 PHP 8. token_get_all() PHP/CodeSniffer/Standards/Squiz/Sniffs/Strings/DoubleQuoteUsageSniff.php:65 Warning: Unexpected character in input: ''' (ASCII=39) state=1 in PHP/CodeSniffer/Standards/Squiz/Sniffs/Strings/DoubleQuoteUsageSniff.php on line 66 Call Stack: 0.0004 50256 1. {main}() phpcs:0 0.0187 1018560 2. PHP_CodeSniffer_CLI->process() phpcs:30 0.0193 1022920 3. PHP_CodeSniffer->process() PHP/CodeSniffer/CLI.php:429 0.1363 4577440 4. PHP_CodeSniffer->processFile() PHP/CodeSniffer.php:376 0.1365 4577808 5. PHP_CodeSniffer->_processFile() PHP/CodeSniffer.php:836 0.1365 4578620 6. PHP_CodeSniffer_File->start() PHP/CodeSniffer.php:921 0.1514 4721892 7. Squiz_Sniffs_Strings_DoubleQuoteUsageSniff->process() PHP/CodeSniffer/File.php:431 0.1514 4721892 8. token_get_all() PHP/CodeSniffer/Standards/Squiz/Sniffs/Strings/DoubleQuoteUsageSniff.php:65 PHP CODE SNIFFER REPORT SUMMARY -------------------------------------------------------------------------- FILE ERRORS WARNINGS -------------------------------------------------------------------------- test.php 11 1 -------------------------------------------------------------------------- A TOTAL OF 11 ERROR(S) AND 1 WARNING(S) WERE FOUND IN 1 FILE(S) --------------------------------------------------------------------------

Comments

 [2010-03-17 04:09 UTC] ashnazg (Chuck Burgess)
That "Warning" line should be showing line 65, not 66, so that all references to DoubleQuoteUsageSniff.php should show 65.
 [2010-03-17 10:38 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2010-03-19 04:47 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2010-03-23 01:54 UTC] ashnazg (Chuck Burgess)
-Status: Feedback +Status: Closed
The current SVN tests fine against my test script. It looks like rev #295609 did indeed clear this bug.