Bug #19666 [Asn->Csd]: PSR1.Files.SideEffects throws a notice "Undefined index: scope_closer ..."
| From: | gsherwood at squiz dot net | Date: | Fri, 26 Oct 2012 04:13:49 +0000 |
| Subject: | Bug #19666 [Asn->Csd]: PSR1.Files.SideEffects throws a notice "Undefined index: scope_closer ..." | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-9248@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19666&edit=1
ID: 19666
Updated by: gsherwood@squiz.net
Reported By: andygrunwald at gmail dot com
Summary: PSR1.Files.SideEffects throws a notice "Undefined
index: scope_closer ..."
-Status: Assigned
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: MacOSX
Package Version: SVN
PHP Version: 5.3.17
Assigned To: squiz
Roadmap Versions:
New Comment:
-Status: Assigned
+Status: Closed
Fixed in github repo. Actually needed a change to the tokenizer rather
than the sniff:
https://github.com/squizlabs/PHP_CodeSniffer/commit/5ea94def4cb705abcc51f1adf9
d116021715f935
Previous Comments:
------------------------------------------------------------------------
[2012-10-26 04:39:45] squiz
-Assigned To:
+Assigned To: squiz
Smallest bit of code I can replicate with:
function render() {
do {
} while (true);
$wrap = isset($var) ? true : false;
}
Caused by tokenizer seeing that WHILE as being opened by the INLINE
ELSE, which
is being tokenized as simply a COLON, another token that can open a
while loop.
------------------------------------------------------------------------
[2012-10-22 15:57:01] andygrunwald
Description:
------------
The sniff "PSR1.Files.SideEffects" throws a notice: "Notice:
Undefined index: scope_closer in
.../CodeSniffer/Standards/PSR1/Sniffs/Files/SideEffectsSniff.php
on line 149"
You will find the backtrace in "Actual result". In this backtrace i
removed my local pathes
Test script:
---------------
1. Get the PHP file "ContentContentObject.php" from
https://github.com/typo3/TYPO3v4-Core/blob/master/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
2. Execute the following command: php PHP_CodeSniffer-Fork/scripts/phpcs
--standard=PSR1 --sniffs=PSR1.Files.SideEffects ContentContentObject.php
-v --extensions=php,inc
Expected result:
----------------
No results / notices
Actual result:
--------------
Registering sniffs in PSR1 standard... DONE (1 sniffs registered)
Creating file list... DONE (1 files in queue)
Changing into directory
/Users/andygrunwald/Development/TYPO3/typo3_src-
git/typo3/sysext/frontend/Classes/ContentObject
Processing ContentContentObject.php [1657 tokens in 159
lines]... PHP Notice: Undefined index: scope_closer in
CodeSniffer/Standards/PSR1/Sniffs/Files/SideEffectsSniff.php on
line 149
PHP Stack trace:
PHP 1. {main}() scripts/phpcs:0
PHP 2. PHP_CodeSniffer_CLI->process() scripts/phpcs:37
PHP 3. PHP_CodeSniffer->process() CodeSniffer/CLI.php:561
PHP 4. PHP_CodeSniffer->processFile() CodeSniffer.php:504
PHP 5. PHP_CodeSniffer->_processFile() CodeSniffer.php:1302
PHP 6. PHP_CodeSniffer_File->start() CodeSniffer.php:1424
PHP 7. PSR1_Sniffs_Files_SideEffectsSniff->process()
CodeSniffer/File.php:492
PHP 8. PSR1_Sniffs_Files_SideEffectsSniff-
>_searchForConflict()
CodeSniffer/Standards/PSR1/Sniffs/Files/SideEffectsSniff.php:63
Notice: Undefined index: scope_closer in
CodeSniffer/Standards/PSR1/Sniffs/Files/SideEffectsSniff.php on
line 149
Call Stack:
0.0129 635152 1. {main}() scripts/phpcs:0
0.0253 2372376 2. PHP_CodeSniffer_CLI->process()
scripts/phpcs:37
0.0259 2381448 3. PHP_CodeSniffer->process()
CodeSniffer/CLI.php:561
0.0623 2698816 4. PHP_CodeSniffer->processFile()
CodeSniffer.php:504
0.0624 2699224 5. PHP_CodeSniffer->_processFile()
CodeSniffer.php:1302
0.0625 2702080 6. PHP_CodeSniffer_File->start()
CodeSniffer.php:1424
0.1303 5241416 7. PSR1_Sniffs_Files_SideEffectsSniff-
>process() CodeSniffer/File.php:492
0.1303 5241512 8. PSR1_Sniffs_Files_SideEffectsSniff-
>_searchForConflict()
CodeSniffer/Standards/PSR1/Sniffs/Files/SideEffectsSniff.php:63
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19666&edit=1