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

Notice: Undefined index: parenthesis_closer #248

Closed
wedi opened this issue Oct 10, 2014 · 7 comments
Closed

Notice: Undefined index: parenthesis_closer #248

wedi opened this issue Oct 10, 2014 · 7 comments

Comments

@wedi
Copy link

wedi commented Oct 10, 2014

Good day!
When checking my plugin files using your great work I get the following notice:

Notice: Undefined index: parenthesis_closer in WordPress/Sniffs/VIP/ValidatedSanitizedInputSniff.php on line 117

Call Stack:
    0.0021     232280   1. {main}() ~/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcs:0
    0.0210    1186312   2. PHP_CodeSniffer_CLI->process() ~/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcs:37
    0.0274    1240616   3. PHP_CodeSniffer->process() ~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php:622
    0.1842    2449128   4. PHP_CodeSniffer->processFile() ~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php:488
    0.1843    2449432   5. PHP_CodeSniffer->_processFile() ~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php:1351
    0.1843    2449880   6. PHP_CodeSniffer_File->start() ~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php:1471
    0.3347    5710256   7. WordPress_Sniffs_VIP_ValidatedSanitizedInputSniff->process() ~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/File.php:506
php -v
PHP 5.4.33 (cli) (built: Oct 10 2014 18:46:18)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
@westonruter
Copy link
Member

@wedi thanks for the report. Do you have some sample PHP code which causes this notice to appear?

@wedi
Copy link
Author

wedi commented Oct 14, 2014

Unfortunately no. As you can see above it hasn't told me where the error was triggered and in the meantime I switched to WordPress-Core, removed all codestyle issues there, did some more coding and now it doesn't show up anymore.

@GaryJones
Copy link
Member

Closing for now then, but if anyone triggers the same error (I think I've seen it too, but I was too busy to stop and take notes), then feel free to post and it can be re-opened.

@grappler
Copy link
Member

grappler commented Jan 5, 2017

I got this error with this code as it is missing a bracket at the end.

echo add_filter( get_the_excerpt( get_the_ID() ) ;

Error: PHP Notice: Undefined index: parenthesis_closer in /WordPress/Sniffs/XSS/EscapeOutputSniff.php on line 322 PHP Notice: Undefined index: parenthesis_closer in /WordPress/Sniffs/XSS/EscapeOutputSniff.php on line 220

Was running PHP 7.1.0 (cli) and the latest dev version of WPCS and PHPCS 2.7.1

@jrfnl
Copy link
Member

jrfnl commented Jan 5, 2017

I suggest adding a complete review for "live coding" type of situations (which will typically be code with parse errors like this) to the other reviews as suggested in #763, #764

@grappler Just wondering: did the Generic.PHP.Syntax sniff throw an error for that file for the missing bracket / parse error ? (only in extra)

@grappler
Copy link
Member

grappler commented Jan 5, 2017

@jrfnl No, because the PHPCS failed at that point but Generic.PHP.Syntax throws an error when I test your PR.

@jrfnl
Copy link
Member

jrfnl commented Jan 5, 2017

@grappler Ok, good.
I tested this myself as well (as travis was failing and I had to look at the unit tests) and found something off in that sniff, so opened an upstream PR to fix that: squizlabs/PHP_CodeSniffer#1260

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

No branches or pull requests

5 participants