Duplicated semicolons generates exception in CSSParser::parseIdentifier #42

Closed
raffishquartan opened this Issue Jul 12, 2012 · 1 comment

Comments

Projects
None yet
2 participants

Trying to parse the DokuWiki CSS file at the link below generates an exception in CSSParser::parseIdentifier() on line 115 with the message "Identifier expected, got ;widt".

CSS file link: http://www.syntilect.com/cgf/lib/exe/css.php

Examining the CSS file shows a duplicated semicolon (after right:237px). I suspect this is affecting the parser - will have a look and see if I can find an easy fix.

div.dokuwiki div.ajax_qsearch{position:absolute;right:237px;;width:200px;opacity:0.9;display:none;font-size:80%;line-height:1.2em;border:1px solid #8cacbb;background-color:#f7f9fa;text-align:left;padding:4px;}

A few more quick thoughts:

CSSParser::parseIdentifier throws an exception because CSSParser::parseCharacter returns null when asked to parse a ';' character. A very crude solution to this problem is to add the code:

while($this->peek() == ';') { $this->consume(); }

to the beginning of CSSParser::parseRule. A better solution might be to engineer the Rule parser to handle "empty rules" but I haven't had the time to look into the code enough to figure out how to make it do this... I'll leave the issue open for further discussion on this if nec.

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