samclarke / SBBCodeParser

BBCode Parser Class
http://www.samclarke.com/
24 stars 15 forks source link

PHP error when using detect_emoticons() #18

Open cyphix333 opened 9 years ago

cyphix333 commented 9 years ago

I have noticed that whilst this works:

echo $parser->parse(file_get_contents('data.txt'))
    ->detect_links()
    ->get_html();

This however produces an error:

echo $parser->parse(file_get_contents('data.txt'))
    ->detect_links()
    ->detect_emoticons()
    ->get_html();

This is the error I get whenever I try and use "detect_emoticons()"..

Warning: preg_match_all(): No ending delimiter ')' found in D:\***********\bbcode\classes\Node\Container\Document.php on line 1009
cyphix333 commented 9 years ago

Update: I have noticed it only does it if you have no emoticons added via something like:

$parser->add_emoticons(array(
    ':)' => 'http://localhost/Classes/SCEditor-punbb/punbb-1.3.5/img/smilies/smile.png',
    '=)' => 'http://localhost/Classes/SCEditor-punbb/punbb-1.3.5/img/smilies/smile.png'
));

...and you try and use it. As long as you add emoticons as above then it will work.