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

Some class names cause CSS tokenizer to hang #636

Closed
mathieuchateau opened this issue Jun 29, 2015 · 1 comment
Closed

Some class names cause CSS tokenizer to hang #636

mathieuchateau opened this issue Jun 29, 2015 · 1 comment

Comments

@mathieuchateau
Copy link

Hello,

While processing still same site as issue before, phpcs hangs, apparently forever, on a css file.

Even when trying phpcs with just this file, still no progress after 15mn:

phpcs -v -d memory_limit=2048M /path/to/bootstrap-switch/static/stylesheets/bootstrap-switch.css
Registering sniffs in the PEAR standard... DONE (27 sniffs registered)
Creating file list... DONE (1 files in queue)
Changing into directory /path/to/bootstrap-switch/static/stylesheets
Processing bootstrap-switch.css

that's it, it stay on this line, eating 100%cpu of one core.
it's a 408 line CSS, here is the source of it:
https://gist.github.com/mathieuchateau/b561a361dbfb44f0830b

I am more worried that it can litterally block phpcs than quality of this css

@gsherwood gsherwood changed the title 3.2.3 - analyze hang one 1 css file Some class names cause CSS tokenizer to hang Jul 6, 2015
@gsherwood
Copy link
Member

Thanks for posting the file. The tokenizer itself wasn't hanging forever; it was backtracking every time it saw the "switch" string because it piggy-backs off the PHP tokenizer. I've added more PHP constructs to the CSS blacklist so the tokenizer doesn't try to process them, which fixes this file, and hopefully all others like it.

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