sabberworm / PHP-CSS-Parser

A Parser for CSS Files written in PHP. Allows extraction of CSS files into a data structure, manipulation of said structure and output as (optimized) CSS

Home Page:http://www.sabberworm.com/blog/2010/6/10/php-css-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Illegal character warning from iconv

nikic opened this issue · comments

Parsing the input @\Afffff produces an "illegal character" warning from iconv. Possibly this just needs to be suppressed or converted into an exception?

#1 /home/nikic/PHP-Fuzzer/example/PHP-CSS-Parser/lib/Sabberworm/CSS/Parsing/ParserState.php(96): iconv('utf-32le', 'utf-8', '\xFF\xFF\xAF\x00')
#2 /home/nikic/PHP-Fuzzer/example/PHP-CSS-Parser/lib/Sabberworm/CSS/Parsing/ParserState.php(52): Sabberworm\CSS\Parsing\ParserState->parseCharacter(true)
#3 /home/nikic/PHP-Fuzzer/example/PHP-CSS-Parser/lib/Sabberworm/CSS/CSSList/CSSList.php(107): Sabberworm\CSS\Parsing\ParserState->parseIdentifier()
#4 /home/nikic/PHP-Fuzzer/example/PHP-CSS-Parser/lib/Sabberworm/CSS/CSSList/CSSList.php(75): Sabberworm\CSS\CSSList\CSSList::parseAtRule(Object(Sabberworm\CSS\Parsing\ParserState))
#5 /home/nikic/PHP-Fuzzer/example/PHP-CSS-Parser/lib/Sabberworm/CSS/CSSList/CSSList.php(50): Sabberworm\CSS\CSSList\CSSList::parseListItem(Object(Sabberworm\CSS\Parsing\ParserState), Object(Sabberworm\CSS\CSSList\Document))
#6 /home/nikic/PHP-Fuzzer/example/PHP-CSS-Parser/lib/Sabberworm/CSS/CSSList/Document.php(21): Sabberworm\CSS\CSSList\CSSList::parseList(Object(Sabberworm\CSS\Parsing\ParserState), Object(Sabberworm\CSS\CSSList\Document))
#7 /home/nikic/PHP-Fuzzer/example/PHP-CSS-Parser/lib/Sabberworm/CSS/Parser.php(38): Sabberworm\CSS\CSSList\Document::parse(Object(Sabberworm\CSS\Parsing\ParserState))
#8 /home/nikic/PHP-Fuzzer/example/target_css_parser.php(9): Sabberworm\CSS\Parser->parse()

I have the similar problem with iconv:

[2020-02-04 09:39:11] (WARN @ /web/core/components/minifyx/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/ParserState.php : 96)
PHP notice: iconv(): Wrong charset, conversion from `utf-32le' to `utf-8' is not allowed
.css:before {content: "";}

My code:

$parser = new Sabberworm\CSS\Parser('.css:before{content:"\f934"}');
$document = $parser->parse();
echo $document->render();

\f934 - this is unicode from FontAwesome;
PHP Version 7.1.33

ezoic increase your site revenue