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

PHP Notices: Undefined index: bracket_closer - JS Files #1271

Closed
grappler opened this issue Jan 14, 2017 · 2 comments
Closed

PHP Notices: Undefined index: bracket_closer - JS Files #1271

grappler opened this issue Jan 14, 2017 · 2 comments

Comments

@grappler
Copy link

I ran PHPCS on all of the WordPress themes that have been updated in the last two years. When doing so I got a PHP notice while processing certain JS files. I did not write the code and do not have access to change it.

When running PHPCS on theme-customizer.js I get the following errors while using PHPCS 2.7.1

Processing theme-customizer.js PHP Notice:  Undefined index: bracket_closer in  CodeSniffer/Tokenizers/JS.php on line 1078

Notice: Undefined index: bracket_closer in  CodeSniffer/Tokenizers/JS.php on line 1078
PHP Notice:  Undefined offset: 480 in  CodeSniffer/File.php on line 731

Notice: Undefined offset: 480 in  CodeSniffer/File.php on line 731
[JS => 481 tokens in  lines]... PHP Notice:  Undefined index: content in  CodeSniffer/Fixer.php on line 139

Notice: Undefined index: content in  CodeSniffer/Fixer.php on line 139
DONE in 4ms (0 errors, 0 warnings)

Here are further list of files that get the same errors.

@gsherwood
Copy link
Member

These files produce errors because they have unmatched parenthesis in them, which would also be causing syntax errors.

I've made some changes over recent versions to hide errors caused by syntax errors in PHP code, so I think it makes sense to do the same here.

@gsherwood
Copy link
Member

I've added guard code for this specific syntax error. Thanks for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants