- Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
I have noticed that if a php file is sniffed which contains a merge conflict inside a function it will result in an endless loop.
Example:
<?php function test() { $arr = array( 'a' => 'a' <<<<<<< HEAD 'b' => 'b' ======= 'c' => 'c' >>>>>>> master ); }
This will result in an endless loop when running the following command:
phpcs --report=checkstyle --standard=PSR2 ./test.php
The console will spit out the following endlessly:
PHP Notice: Undefined offset: 1014 in /home/user/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Tokenizers/PHP.php on line 553 PHP Notice: Undefined offset: 1180 in /home/user/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Tokenizers/PHP.php on line 1000 PHP Notice: Undefined offset: 1181 in /home/user/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Tokenizers/PHP.php on line 1000 PHP Notice: Undefined offset: 1182 in /home/user/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Tokenizers/PHP.php on line 1000 PHP Notice: Undefined offset: 1183 in /home/user/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Tokenizers/PHP.php on line 1000
I have noticed this happening on other occasions with different invalid php but unfortunately I don't have any examples on hand. I am using version 2.5.1