Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.2

Bug #17337 CSS tokenizer fails on quotes urls
Submitted: 2010-04-23 02:27 UTC
From: sicromoft Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.2.2)
PHP Version: 5.2.7 OS: Centos 4.5
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 17 + 8 = ?

 
 [2010-04-23 02:27 UTC] sicromoft (Russell Davis)
Description: ------------ The CSS tokenizer fails to turn quoted urls into type T_URL. It's a simple fix in Tokenizer/CSS.PHP: Line 245: change "$x + 2" to "$x + 1" Line 257: change ".=" to "=" Test script: --------------- .test { background-image: url("foobar.png"); } Expected result: ---------------- expect the tokenizer to create a T_URL token with value "foobar.png" Actual result: -------------- The tokenizer just creates a T_CONSTANT_ENCAPSED_STRING

Comments

 [2010-04-23 04:53 UTC] squiz (Greg Sherwood)
I see the error, but your fix actually puts the tokens in incorrect positions for me (at the end). Something else obviously needs fixing as well, so let me look into it.
 [2010-04-23 05:08 UTC] squiz (Greg Sherwood)
-Assigned To: +Assigned To: squiz
Found the problem. If the contnet inside the "url()" is in double quotes there will only be one token and so we don't have to do anything except change its type. If it is not empty, we need to do some token merging. What it was doing is just not changing the token type unless there was more than one token inside the "url()". So no changes to the merging code needed at all - just needed to move a couple of lines out of the if statement.
 [2010-04-23 05:10 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.