Bug #19361 [Fbk]: Undefined index: bracket_closer in .../Tokenizers/CSS.php
| From: | gsherwood at squiz dot net | Date: | Wed, 11 Apr 2012 02:03:16 +0000 |
| Subject: | Bug #19361 [Fbk]: Undefined index: bracket_closer in .../Tokenizers/CSS.php | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8549@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19361&edit=1
ID: 19361
Updated by: gsherwood@squiz.net
Reported By: news_001 at washammwa dot de
Summary: Undefined index: bracket_closer in
.../Tokenizers/CSS.php
Status: Feedback
Type: Bug
Package: PHP_CodeSniffer
Operating System: debian squeez
Package Version: 1.3.3
PHP Version: 5.3.3
Assigned To: squiz
Roadmap Versions:
New Comment:
I think I see the problem. When PHP tokenizes this string, it see the
closing tag and
then stops tokenizing the rest. It wont handle PHP embedded into a CSS
or JS file,
where it doesn't expect there to be any PHP tags.
Even though I can't get the tokenizer errors, they look the same as the
sniff errors,
so I think fixing this will fix your main issue.
Previous Comments:
------------------------------------------------------------------------
[2012-04-11 02:56:39] squiz
I cant get any tokenizer errors to be reported, but I get a errors from
the sniffs,
which I will look at. I don't know if they will fix the issue you have
reported or not.
Does the formatting of the CSS file look correct in your comment? Can
you paste that
single line onto line 2 of a blank CSS file and have PHPCS generate
errors or is there
more in the file?
------------------------------------------------------------------------
[2012-04-04 10:00:41] christianweiss
li {} should be in second line. first line is empty
------------------------------------------------------------------------
[2012-04-04 09:46:26] christianweiss
CSS file is:
li { background:url(<?php print $staticserver; ?>images/bullet.gif) left
1px no-repeat; margin:0px; padding-left:10px; margin-bottom:5px;
line-height:13px;}
I know it is not usual to have css files to be executed by php but your
tokenizer should be robust enought.
csslint (http://csslint.net/about.html) has no trouble to tokenize it.
A sniff that warns that this type of dynamic css smells should be
available.
------------------------------------------------------------------------
[2012-03-30 22:46:36] squiz
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
Do you happen to have the CSS file that PHPCS was running on when the
error occurred? I wont be able to fix this with just a backtrace because
the order of tokens
is really important for this.
------------------------------------------------------------------------
[2012-03-30 16:32:47] christianweiss
Description:
------------
[exec] PHP Notice: Undefined index: bracket_closer in
/usr/share/php/PHP/CodeSniffer/Tokenizers/CSS.php on line 350
[exec] PHP Stack trace:
[exec] PHP 1. {main}() /usr/bin/phpcs:0
[exec] PHP 2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:37
[exec] PHP 3. PHP_CodeSniffer->process()
/usr/share/php/PHP/CodeSniffer/CLI.php:551
[exec] PHP 4. PHP_CodeSniffer->processFile()
/usr/share/php/PHP/CodeSniffer.php:476
[exec] PHP 5. PHP_CodeSniffer->_processFile()
/usr/share/php/PHP/CodeSniffer.php:1159
[exec] PHP 6. PHP_CodeSniffer_File->start()
/usr/share/php/PHP/CodeSniffer.php:1279
[exec] PHP 7. PHP_CodeSniffer_File->_parse()
/usr/share/php/PHP/CodeSniffer/File.php:382
[exec] PHP 8. PHP_CodeSniffer_File::tokenizeString()
/usr/share/php/PHP/CodeSniffer/File.php:586
[exec] PHP 9. PHP_CodeSniffer_Tokenizers_CSS->processAdditional()
/usr/share/php/PHP/CodeSniffer/File.php:969
[exec] PHP Notice: Undefined index: bracket_closer in
/usr/share/php/PHP/CodeSniffer/Tokenizers/CSS.php on line 351
[exec] PHP Stack trace:
[exec] PHP 1. {main}() /usr/bin/phpcs:0
[exec] PHP 2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:37
[exec] PHP 3. PHP_CodeSniffer->process()
/usr/share/php/PHP/CodeSniffer/CLI.php:551
[exec] PHP 4. PHP_CodeSniffer->processFile()
/usr/share/php/PHP/CodeSniffer.php:476
[exec] PHP 5. PHP_CodeSniffer->_processFile()
/usr/share/php/PHP/CodeSniffer.php:1159
[exec] PHP 6. PHP_CodeSniffer_File->start()
/usr/share/php/PHP/CodeSniffer.php:1279
[exec] PHP 7. PHP_CodeSniffer_File->_parse()
/usr/share/php/PHP/CodeSniffer/File.php:382
[exec] PHP 8. PHP_CodeSniffer_File::tokenizeString()
/usr/share/php/PHP/CodeSniffer/File.php:586
[exec] PHP 9. PHP_CodeSniffer_Tokenizers_CSS->processAdditional()
/usr/share/php/PHP/CodeSniffer/File.php:969
Directly from my ant output (Hudson CI)
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19361&edit=1