Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined offset: 42509 in /opt/composer/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php on line 218 #590

Closed
kkmuffme opened this issue Oct 23, 2020 · 2 comments · Fixed by #592
Milestone

Comments

@kkmuffme
Copy link

Bug Description

I get the following notice when using the PHPCS VIP Sniff. The issue seems to be file specific though:
Undefined offset: 42509 in /opt/composer/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php on line 218

Trace:

File: \opt\composer\vendor\squizlabs\php_codesniffer\src\Runner.php on line 606
Trace:
#0 /opt/composer/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php (218): PHP_CodeSniffer\Runner->handleErrors( $code = 8888888, $message = Undefined offset: 42509, $file = /opt/composer/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php, $line = 218, Array( [i] => 1 ) )
#1 /opt/composer/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php (86): WordPressVIPMinimum\Sniffs\Functions\DynamicCallsSniff->find_dynamic_calls()
#2 /opt/composer/vendor/wp-coding-standards/wpcs/WordPress/Sniff.php (910): WordPressVIPMinimum\Sniffs\Functions\DynamicCallsSniff->process_token( $stackPtr = 42508 )
#3 /opt/composer/vendor/squizlabs/php_codesniffer/src/Files/File.php (496): WordPressCS\WordPress\Sniff->process( $phpcsFile = PHP_CodeSniffer\Files\LocalFile Object, $stackPtr = 42508 )
#4 /opt/composer/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php (91): PHP_CodeSniffer\Files\File->process()
#5 /opt/composer/vendor/squizlabs/php_codesniffer/src/Fixer.php (174): PHP_CodeSniffer\Files\LocalFile->process()
#6 /opt/composer/vendor/squizlabs/php_codesniffer/src/Reports/Cbf.php (49): PHP_CodeSniffer\Fixer->fixFile()
#7 /opt/composer/vendor/squizlabs/php_codesniffer/src/Reporter.php (285): PHP_CodeSniffer\Reports\Cbf->generateFileReport( $report =
Array(
 [filename] => /my-path/my-file.php
 [errors] => 843
 [warnings] => 205
 [fixable] => 816
 [messages] => Array(
   [1] => Array(
     [1] => Array(
       [0] => Array(... TRUNCATED
, $phpcsFile = PHP_CodeSniffer\Files\LocalFile ObjectPHP_CodeSniffer\Files\LocalFile ObjectPHP_CodeSniffer\Files\LocalFile ObjectPHP_CodeSniffer\Files\LocalFile ObjectPHP_CodeSniffer\Files\LocalFile Object, $showSources = false, $width = 0 )
#8 /opt/composer/vendor/squizlabs/php_codesniffer/src/Runner.php (656): PHP_CodeSniffer\Reporter->cacheFileReport( $phpcsFile = PHP_CodeSniffer\Files\LocalFile Object, PHP_CodeSniffer\Config Object )
#9 /opt/composer/vendor/squizlabs/php_codesniffer/src/Runner.php (434): PHP_CodeSniffer\Runner->processFile( $file = PHP_CodeSniffer\Files\LocalFile Object )
#10 /opt/composer/vendor/squizlabs/php_codesniffer/src/Runner.php (200): PHP_CodeSniffer\Runner->run()
#11 /opt/composer/vendor/squizlabs/php_codesniffer/bin/phpcbf (18): PHP_CodeSniffer\Runner->runPHPCBF()

Minimal Code Snippet

Can you see if you can check it with the above trace? As this was a development file and we don't have that version anymore.

Environment

Use php -v and composer show to get versions.

Question Answer
PHP version PHP 7.4.11
PHP_CodeSniffer version 3.5.6
VIPCS version 2.2.0
@jrfnl
Copy link
Collaborator

jrfnl commented Oct 23, 2020

No, we can't figure out the code sample from the backtrace. There is literally nothing there to give us a clue what type of code caused this.

All the same, looking at the code of the sniff, this seems like something which can be fixed quite easily. I'll send in a PR.

@jrfnl
Copy link
Collaborator

jrfnl commented Oct 23, 2020

PR #592 should fix this.

@jrfnl jrfnl added this to the 2.3.0 milestone Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants